mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-20 22:23:36 +00:00
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:
@@ -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
|
||||
'"'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user