From 77ceca7a6ed35679b927d919e60062512659a9bb Mon Sep 17 00:00:00 2001 From: Alex Newman Date: Fri, 26 Dec 2025 20:48:15 -0500 Subject: [PATCH] fix: handle process exit in waitForProcessesExit filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The process.kill(pid, 0) call throws when a process has exited, which crashed the filter callback. Wrapped in try/catch to correctly return false for exited processes. Fixes critical bug found in PR #458 review (Phase 1). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/services/worker-service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/worker-service.ts b/src/services/worker-service.ts index 17e46ed2..64b0d1ea 100644 --- a/src/services/worker-service.ts +++ b/src/services/worker-service.ts @@ -754,8 +754,12 @@ export class WorkerService { while (Date.now() - start < timeoutMs) { const stillAlive = pids.filter(pid => { - process.kill(pid, 0); // Signal 0 checks if process exists - throws if dead - return true; + try { + process.kill(pid, 0); + return true; + } catch { + return false; + } }); if (stillAlive.length === 0) {