fix: preserve Windows cmd start URL quoting (#794) (thanks @roshanasingh4)

This commit is contained in:
Peter Steinberger
2026-01-13 04:26:43 +00:00
parent ea9486ae2d
commit 3061d8e057
5 changed files with 26 additions and 5 deletions

View File

@@ -48,6 +48,7 @@ export type CommandOptions = {
cwd?: string;
input?: string;
env?: NodeJS.ProcessEnv;
windowsVerbatimArguments?: boolean;
};
export async function runCommandWithTimeout(
@@ -59,6 +60,7 @@ export async function runCommandWithTimeout(
? { timeoutMs: optionsOrTimeout }
: optionsOrTimeout;
const { timeoutMs, cwd, input, env } = options;
const { windowsVerbatimArguments } = options;
const hasInput = input !== undefined;
// Spawn with inherited stdin (TTY) so tools like `pi` stay interactive when needed.
@@ -67,6 +69,7 @@ export async function runCommandWithTimeout(
stdio: [hasInput ? "pipe" : "inherit", "pipe", "pipe"],
cwd,
env: env ? { ...process.env, ...env } : process.env,
windowsVerbatimArguments,
});
let stdout = "";
let stderr = "";