fix(runtime-process): preserve EPERM in Windows pty-host sweep exit-poll
The catch in sweepWindowsPtyHosts treated every error as "process exited", including EPERM. On Windows EPERM means the pty-host exists but the caller lacks permission to signal it (cross-context), so the orphan was skipping the killProcessTree force-kill step and leaking. Mirror the destroy() logic at line 290: only flag exited on non-EPERM (typically ESRCH). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
df56e36ca7
commit
f825dff6c7
|
|
@ -525,8 +525,13 @@ export async function sweepWindowsPtyHosts(): Promise<{
|
|||
while (Date.now() < deadline) {
|
||||
try {
|
||||
process.kill(entry.ptyHostPid, 0);
|
||||
} catch {
|
||||
exited = true;
|
||||
} catch (err: unknown) {
|
||||
// EPERM: process exists but we can't signal it (cross-context on
|
||||
// Windows). It is NOT gone — fall through to force-kill. Any other
|
||||
// code (typically ESRCH) means it has already exited.
|
||||
if ((err as { code?: string }).code !== "EPERM") {
|
||||
exited = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 25));
|
||||
|
|
|
|||
Loading…
Reference in New Issue