perf: fast-path Windows arguments without escapes

This commit is contained in:
Orca Worker
2026-09-11 23:20:46 -07:00
parent 20ab995065
commit 5e3bbef051
@@ -32,6 +32,9 @@
* because that part `CommandLineToArgvW` does interpret.
*/
function quoteWindows(value: string, escapePercent: boolean): string {
if (!(escapePercent ? /[\\"%]/ : /[\\"]/).test(value)) {
return `"${value}"`
}
let quoted = '"'
let backslashes = 0
for (const char of value) {