From 35e2986cec1c9947451e69bde878df30a248d4e2 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Sat, 12 Sep 2026 18:10:01 -0700 Subject: [PATCH] perf: fast-path Windows arguments without escapes (#20318) Co-authored-by: Orca Worker --- src/shared/child-process/windows-command-line.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/child-process/windows-command-line.ts b/src/shared/child-process/windows-command-line.ts index 401141e36c7..e3402f93c19 100644 --- a/src/shared/child-process/windows-command-line.ts +++ b/src/shared/child-process/windows-command-line.ts @@ -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) {