fix(desktop): preserve Windows terminal hook smoke command

The outer batch shell expanded the hook variable and control operators before terminal send-keys received them. Encode the probe for PowerShell so expansion happens inside the packaged terminal.
This commit is contained in:
Mohamed Boudra
2026-07-22 13:16:27 +02:00
parent 246c07fba5
commit 68993b7ab3

View File

@@ -130,7 +130,13 @@ function shellQuoteCliArg(value) {
function getTerminalHookSmokeCommand(marker) { function getTerminalHookSmokeCommand(marker) {
if (process.platform === "win32") { if (process.platform === "win32") {
return `"%PASEO_HOOK_CLI%" hooks codex Stop && echo ${marker}`; const script = [
"& $env:PASEO_HOOK_CLI hooks codex Stop",
"if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }",
`Write-Output '${marker}'`,
].join("; ");
const encodedScript = Buffer.from(script, "utf16le").toString("base64");
return `powershell.exe -NoProfile -NonInteractive -EncodedCommand ${encodedScript}`;
} }
return `"$PASEO_HOOK_CLI" hooks codex Stop && echo ${marker}`; return `"$PASEO_HOOK_CLI" hooks codex Stop && echo ${marker}`;