fix(targets): use cmd.exe for escaped Windows wrapper launches

Align Windows .cmd/.bat launch behavior with the Codex detector shell contract.

This keeps escaped -c overrides intact through wrapper execution.

Adds regression coverage for the Codex runtime path and the shared Windows shell launch path.
This commit is contained in:
Tam Nhu Tran committed 2026-04-19 14:09:12 -04:00
1 parent 9ccac9bf39
commit a945b0b104
7 files changed
+149 -9

No files matched your search

+11 -1
View File
@@ -107,6 +107,16 @@ export function escapeShellArg(arg: string): string {
}
}
/**
* Return the Windows shell that matches escapeShellArg() quoting semantics.
*
* `shell: true` is not strict enough for npm `.cmd` wrappers because Node may
* route through a different quoting path than the one escapeShellArg() expects.
*/
export function getWindowsEscapedCommandShell(): string {
return 'cmd.exe';
}
/**
* Execute Claude CLI with unified spawn logic
*/
@@ -182,7 +192,7 @@ export function execClaude(
child = spawn(cmdString, {
stdio: 'inherit',
windowsHide: true,
shell: true,
shell: getWindowsEscapedCommandShell(),
env,
});
} else {