fix(shell): escape ! for cmd.exe delayed expansion

Adds defensive escaping for exclamation marks in case delayed
expansion is enabled in the user's cmd.exe environment.
This commit is contained in:
kaitranntt committed 2026-02-05 10:45:07 -05:00
1 parent 48aa3cca30
commit 61bc54af05
2 files changed
+6

No files matched your search

+1
View File
@@ -28,6 +28,7 @@ export function escapeShellArg(arg: string): string {
.replace(/[\r\n\t]/g, ' ') // Replace newlines/tabs with space
.replace(/%/g, '%%') // Escape percent signs
.replace(/\^/g, '^^') // Escape carets
.replace(/!/g, '^^!') // Escape exclamation marks (delayed expansion)
.replace(/"/g, '""') + // Escape quotes
'"'
);