mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 01:40:21 +00:00
refactor: share windows command shim resolution
This commit is contained in:
@@ -7,6 +7,7 @@ import { danger, shouldLogVerbose } from "../globals.js";
|
||||
import { markOpenClawExecEnv } from "../infra/openclaw-exec-env.js";
|
||||
import { logDebug, logError } from "../logger.js";
|
||||
import { resolveCommandStdio } from "./spawn-utils.js";
|
||||
import { resolveWindowsCommandShim } from "./windows-command.js";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
|
||||
@@ -76,19 +77,10 @@ function resolveNpmArgvForWindows(argv: string[]): string[] | null {
|
||||
* are handled by resolveNpmArgvForWindows to avoid spawn EINVAL (no direct .cmd).
|
||||
*/
|
||||
function resolveCommand(command: string): string {
|
||||
if (process.platform !== "win32") {
|
||||
return command;
|
||||
}
|
||||
const basename = path.basename(command).toLowerCase();
|
||||
const ext = path.extname(basename);
|
||||
if (ext) {
|
||||
return command;
|
||||
}
|
||||
const cmdCommands = ["pnpm", "yarn"];
|
||||
if (cmdCommands.includes(basename)) {
|
||||
return `${command}.cmd`;
|
||||
}
|
||||
return command;
|
||||
return resolveWindowsCommandShim({
|
||||
command,
|
||||
cmdCommands: ["pnpm", "yarn"],
|
||||
});
|
||||
}
|
||||
|
||||
export function shouldSpawnWithShell(params: {
|
||||
|
||||
Reference in New Issue
Block a user