From fc508bd19ecf549738439a52fbc1ca0a5fe76427 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:56:24 -0700 Subject: [PATCH] test(windows): read the grandchild pid from accumulated pane output (#33320) The ConPTY job-ownership proof matched ORCA_GC= against each onData chunk, and once gave up after its 20s poll with no pane output to show why. Two causes are possible: a chunk boundary inside the marker, which per-chunk matching never recovers from, or a pane that trails the preceding table stress test. Match the accumulated output and require a non-digit after the pid, bound the poll at 40s, and include the pane tail if it still fails. --- src/main/windows/windows-pty-job.win32.test.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/windows/windows-pty-job.win32.test.ts b/src/main/windows/windows-pty-job.win32.test.ts index 26892390fb6..514f0a1ba2e 100644 --- a/src/main/windows/windows-pty-job.win32.test.ts +++ b/src/main/windows/windows-pty-job.win32.test.ts @@ -71,8 +71,11 @@ describeOnWindows('ConPTY job ownership', () => { spawned.push(proc) let grandchildPid: number | null = null + let output = '' proc.onData((chunk) => { - const match = /ORCA_GC=(\d+)/.exec(chunk) + // ConPTY may split the marker across chunks; a trailing non-digit proves the pid is whole. + output += chunk + const match = /ORCA_GC=(\d+)\D/.exec(output) if (match && grandchildPid === null) { grandchildPid = Number(match[1]) } @@ -86,11 +89,12 @@ describeOnWindows('ConPTY job ownership', () => { ].join('') proc.write(`node -e "${script}"\r`) - for (let attempt = 0; attempt < 80 && grandchildPid === null; attempt += 1) { + // The marker usually lands within 3s, but can trail the preceding table stress test; this only bounds a hang. + for (let attempt = 0; attempt < 160 && grandchildPid === null; attempt += 1) { await sleep(250) } if (grandchildPid === null) { - throw new Error('grandchild never reported its pid') + throw new Error(`grandchild never reported its pid: ${JSON.stringify(output.slice(-600))}`) } // Let the shell settle so the pid list is not read mid-spawn. await sleep(1_000)