fix: use shell mode on Windows for command spawning
On Windows, spawn("npm", [...]) fails with ENOENT because Windows
requires .cmd/.exe extensions or shell-based PATH resolution.
Adding shell: true on Windows enables proper PATH lookup for npm
and other commands spawned via runCommandWithTimeout.
Fixes #4557
Co-Authored-By: Ayush Ojha <ayushozha@outlook.com>
This commit is contained in:
parent
da71eaebd2
commit
9d5abc6354
@ -80,11 +80,13 @@ export async function runCommandWithTimeout(
|
||||
}
|
||||
|
||||
const stdio = resolveCommandStdio({ hasInput, preferInherit: true });
|
||||
const isWindows = process.platform === "win32";
|
||||
const child = spawn(argv[0], argv.slice(1), {
|
||||
stdio,
|
||||
cwd,
|
||||
env: resolvedEnv,
|
||||
windowsVerbatimArguments,
|
||||
shell: isWindows,
|
||||
});
|
||||
// Spawn with inherited stdin (TTY) so tools like `pi` stay interactive when needed.
|
||||
return await new Promise((resolve, reject) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user