diff --git a/packages/subprocess/subprocess-local/tests/spawn.spec.ts b/packages/subprocess/subprocess-local/tests/spawn.spec.ts index 1f87fd67cc..5c83273576 100644 --- a/packages/subprocess/subprocess-local/tests/spawn.spec.ts +++ b/packages/subprocess/subprocess-local/tests/spawn.spec.ts @@ -75,7 +75,9 @@ async function waitGone(pid: number, timeoutMs = 5_000): Promise { const state = stat.slice(stat.lastIndexOf(')') + 2, stat.lastIndexOf(')') + 3) if (state === 'Z' || state === 'X') return } catch (error: unknown) { - if ((error as NodeJS.ErrnoException).code === 'ENOENT') return + // ESRCH = the pid vanished between the kill-0 probe and this read, + // which is the same terminal state ENOENT reports on a settled entry. + if ((error as NodeJS.ErrnoException).code === 'ENOENT' || (error as NodeJS.ErrnoException).code === 'ESRCH') return throw error } }