From af71f9da90d19bd99603794d081de66ae140bc4e Mon Sep 17 00:00:00 2001 From: Ara Date: Tue, 18 Nov 2025 10:17:37 -0800 Subject: [PATCH] fix: resolve double quote escaping in Windows cmd.exe for Background Exec mode (#7523) Fixes #7470 When Terminal Execution Mode is set to "Background Exec", commands with double quotes were being incorrectly escaped on Windows cmd.exe, causing commands like `echo "\""` or `type "test.txt"` to fail. The issue was that cmd.exe requires the /s flag and outer quotes when passing commands with special characters via spawn(). Changed from `["/c", command]` to `["/s", "/c", `"${command}"`]` for cmd.exe only. This is a minimal Windows-specific fix that: - Only affects Windows cmd.exe (PowerShell and Unix shells unchanged) - Uses standard Windows cmd.exe syntax for proper quote handling - No changes to process execution flow or behavior --- standalone/runtime-files/vscode/enhanced-terminal.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/standalone/runtime-files/vscode/enhanced-terminal.js b/standalone/runtime-files/vscode/enhanced-terminal.js index 4efe6e38..33a5293b 100644 --- a/standalone/runtime-files/vscode/enhanced-terminal.js +++ b/standalone/runtime-files/vscode/enhanced-terminal.js @@ -200,7 +200,8 @@ class StandaloneTerminalProcess extends EventEmitter { if (shell.toLowerCase().includes("powershell") || shell.toLowerCase().includes("pwsh")) { return ["-Command", command] } else { - return ["/c", command] + // Use /s /c with quoted command for proper quote handling in cmd.exe + return ["/s", "/c", `"${command}"`] } } else { // Use -l for login shell, -c for command