diff --git a/plugin/hooks/hooks.json b/plugin/hooks/hooks.json index 09c5acd0..f12600e0 100644 --- a/plugin/hooks/hooks.json +++ b/plugin/hooks/hooks.json @@ -24,12 +24,12 @@ }, { "type": "command", - "command": "_R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/thedotmack/plugin\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" start", + "command": "_R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/thedotmack/plugin\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" start; for i in 1 2 3 4 5 6 7 8; do curl -sf http://localhost:37777/health >/dev/null 2>&1 && break; sleep 1; done; curl -sf http://localhost:37777/health >/dev/null 2>&1 || exit 1; echo '{\"continue\":true,\"suppressOutput\":true}'", "timeout": 60 }, { "type": "command", - "command": "_R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/thedotmack/plugin\"; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook claude-code context", + "command": "_R=\"${CLAUDE_PLUGIN_ROOT}\"; [ -z \"$_R\" ] && _R=\"$HOME/.claude/plugins/marketplaces/thedotmack/plugin\"; for i in 1 2 3 4 5 6 7 8; do curl -sf http://localhost:37777/health >/dev/null 2>&1 && break; sleep 1; done; node \"$_R/scripts/bun-runner.js\" \"$_R/scripts/worker-service.cjs\" hook claude-code context", "timeout": 60 } ] diff --git a/plugin/scripts/bun-runner.js b/plugin/scripts/bun-runner.js index 8135718b..0fb34282 100644 --- a/plugin/scripts/bun-runner.js +++ b/plugin/scripts/bun-runner.js @@ -174,6 +174,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); });