Skip to content

Commit 035ea34

Browse files
committed
task-orchestrator: treat serve shutdown aborts as clean exits
1 parent 7e002c5 commit 035ea34

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎src/task-orchestrator/cli.ts‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,24 @@ async function runServeCommand(args: string[]): Promise<void> {
362362
console.log("Press Ctrl+C to stop.");
363363
}
364364

365-
await server.serve();
366-
process.exit(0);
365+
try {
366+
await server.serve();
367+
} catch (err) {
368+
// Resident shutdown can interrupt in-flight source/bridge polling. Once
369+
// SIGINT/SIGTERM has been requested, treat those late abort errors as a
370+
// normal stop instead of surfacing a cleanup-only non-zero exit.
371+
if (!abortController.signal.aborted) {
372+
throw err;
373+
}
374+
}
367375
} finally {
368376
cleanupSignals();
369377
if (runner instanceof CoreIpcStepRunner) {
370378
await runner.shutdown().catch(() => {});
371379
}
372380
}
381+
382+
process.exit(0);
373383
}
374384

375385
async function runStatusCommand(args: string[]): Promise<void> {

0 commit comments

Comments
 (0)