Repository navigation
fix(npm): forward SIGINT/SIGTERM/SIGHUP from the npm shim to the Go binary - #504
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
…inary The shim used execFileSync, which blocks the event loop, so signals sent to the Node process never reached the CLI (hookdeck listen did not shut down cleanly under systemd/docker stop). Use spawn, forward the three signals, propagate the exit code, and re-raise a fatal signal from the child. Fixes hookdeck#429 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #429
Root cause:
bin/hookdeck.jsran the Go binary withexecFileSync, which blocks the Node event loop. A signal delivered to the Node process (e.g.kill <pid>from a supervisor, or a terminal hangup) was therefore never forwarded, and the CLI child was left running/orphaned instead of shutting down cleanly.Fix: use
spawnwithstdio: 'inherit', forwardSIGINT/SIGTERM/SIGHUPto the child, propagate the child's exit code, and if the child dies from a signal re-raise it on the shim so the parent shell sees the same status. A spawn error prints a message and exits 1 (as before).Test:
test-scripts/npm-shim.test.js(node --test test-scripts/, no dependencies) copies the shim next to a fakebinaries/<platform>-<arch>/hookdeckshell script and checks exit-code/argument propagation and that each of the three signals reaches the child. Onmainthe three signal tests hang (signal never delivered); with the fix all 4 pass.Disclosure: this change was prepared with AI assistance (Claude Code) and submitted by a human contributor; the submitter is responsible for the contents.