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
2026-02-05 10:45:07 -05:00
parent 48aa3cca30
commit 61bc54af05
2 changed files with 6 additions and 0 deletions
+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
'"'
);