perf: fast-path Windows arguments without escapes (#20318)

Co-authored-by: Orca Worker <orca-worker@localhost>
This commit is contained in:
OrcaWin
2026-09-12 18:10:01 -07:00
committed by GitHub
co-authored by Orca Worker
parent 99cca036e7
commit 35e2986cec
@@ -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) {