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
This commit is contained in:
1 file changed
+2
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user