From 368daddd88274ce60aea385c9c4f485335a76899 Mon Sep 17 00:00:00 2001 From: nimesh-kumar-sh Date: Fri, 27 Mar 2026 12:52:36 -0700 Subject: [PATCH] fix(bun-runner): treat signal-based exits for 'start' as success Defense-in-depth for #1505. When the 'start' subcommand forks a daemon, the parent bun process may be killed by signal (exit > 128). If the close handler fires, treat this as success since the daemon started fine. Note: the primary fix is in hooks.json since the SIGKILL often kills the entire process group before this handler fires. --- plugin/scripts/bun-runner.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/scripts/bun-runner.js b/plugin/scripts/bun-runner.js index 90ee0997..e1d9bafa 100644 --- a/plugin/scripts/bun-runner.js +++ b/plugin/scripts/bun-runner.js @@ -171,6 +171,12 @@ child.on('error', (err) => { process.exit(1); }); -child.on('close', (code) => { +child.on('close', (code, signal) => { + // Fix #1505: When the "start" subcommand forks a daemon, the parent bun + // process may be killed by signal (e.g. SIGKILL, exit code 137). The daemon + // is running fine — treat signal-based exits for "start" as success. + if (signal || (code > 128 && args.includes('start'))) { + process.exit(0); + } process.exit(code || 0); });