From 59f6fc37485b1055f2d5cc516df68b54cc6747c4 Mon Sep 17 00:00:00 2001 From: ThanhNguyxn Date: Fri, 30 Jan 2026 22:36:49 +0700 Subject: [PATCH] fix(exec): scope Windows shell to npm/pnpm/yarn/npx --- src/process/exec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/process/exec.ts b/src/process/exec.ts index 0e8397c64..d77af40ef 100644 --- a/src/process/exec.ts +++ b/src/process/exec.ts @@ -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) => {