From 8f4426052cb44ece85b4f9ae5f8504bb31a84b57 Mon Sep 17 00:00:00 2001 From: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> Date: Sat, 24 Jan 2026 01:10:40 -0600 Subject: [PATCH] CLI: fix Windows node argv stripping (#1564) Co-authored-by: Tak hoffman --- src/cli/run-main.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cli/run-main.ts b/src/cli/run-main.ts index 6d485130a..d9faa981f 100644 --- a/src/cli/run-main.ts +++ b/src/cli/run-main.ts @@ -1,3 +1,4 @@ +import fs from "node:fs"; import path from "node:path"; import process from "node:process"; import { fileURLToPath } from "node:url"; @@ -82,13 +83,16 @@ function stripWindowsNodeExec(argv: string[]): string[] { const execBase = path.basename(execPath).toLowerCase(); const isExecPath = (value: string | undefined): boolean => { if (!value) return false; - const lower = normalizeCandidate(value).toLowerCase(); + const normalized = normalizeCandidate(value); + if (!normalized) return false; + const lower = normalized.toLowerCase(); return ( lower === execPathLower || path.basename(lower) === execBase || lower.endsWith("\\node.exe") || lower.endsWith("/node.exe") || - lower.includes("node.exe") + lower.includes("node.exe") || + (path.basename(lower) === "node.exe" && fs.existsSync(normalized)) ); }; const filtered = argv.filter((arg, index) => index === 0 || !isExecPath(arg));