fix(exec): scope Windows shell to npm/pnpm/yarn/npx
This commit is contained in:
parent
aaefee78de
commit
59f6fc3748
@ -80,12 +80,15 @@ export async function runCommandWithTimeout(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const stdio = resolveCommandStdio({ hasInput, preferInherit: true });
|
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), {
|
const child = spawn(argv[0], argv.slice(1), {
|
||||||
stdio,
|
stdio,
|
||||||
cwd,
|
cwd,
|
||||||
env: resolvedEnv,
|
env: resolvedEnv,
|
||||||
windowsVerbatimArguments,
|
windowsVerbatimArguments,
|
||||||
shell: process.platform === "win32",
|
shell: needsShell,
|
||||||
});
|
});
|
||||||
// Spawn with inherited stdin (TTY) so tools like `pi` stay interactive when needed.
|
// Spawn with inherited stdin (TTY) so tools like `pi` stay interactive when needed.
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user