fix(exec): scope Windows shell to npm/pnpm/yarn/npx

This commit is contained in:
ThanhNguyxn 2026-01-30 22:36:49 +07:00
parent aaefee78de
commit 59f6fc3748

View File

@ -80,12 +80,15 @@ export async function runCommandWithTimeout(
}
const stdio = resolveCommandStdio({ hasInput, preferInherit: true });
const cmdTool = path.parse(argv[0] ?? "").name;
const needsShell =
process.platform === "win32" && ["npm", "pnpm", "yarn", "npx"].includes(cmdTool);
const child = spawn(argv[0], argv.slice(1), {
stdio,
cwd,
env: resolvedEnv,
windowsVerbatimArguments,
shell: process.platform === "win32",
shell: needsShell,
});
// Spawn with inherited stdin (TTY) so tools like `pi` stay interactive when needed.
return await new Promise((resolve, reject) => {