From f3cc26252c3cd48ce4d5e7b4be556f31342ad5fd Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 15 Feb 2026 09:10:04 -0800 Subject: [PATCH] better status check --- src/server/apps.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/server/apps.ts b/src/server/apps.ts index ade3e7d..e50aa32 100644 --- a/src/server/apps.ts +++ b/src/server/apps.ts @@ -644,12 +644,8 @@ async function runApp(dir: string, port: number) { const survivalThreshold = 5000 // Consider non-HTTP apps running after 5s const startTime = Date.now() - // Use proc.exited as the authoritative death signal instead of ps(1) - let processExited = false - proc.exited.then(() => { processExited = true }) - while (app.state === 'starting' && app.proc === proc) { - if (processExited) { + if (proc.exitCode !== null) { info(app, 'Process died during startup') return } @@ -680,10 +676,7 @@ async function runApp(dir: string, port: number) { // If process survived long enough, consider it running (non-HTTP app) if (Date.now() - startTime >= survivalThreshold) { - // One final check — process could have died between loop iterations - // Yield to let proc.exited handler run if pending - await new Promise(resolve => setTimeout(resolve, 0)) - if (processExited) { + if (proc.exitCode !== null) { info(app, 'Process died during startup') return }