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 }