Skip to content

fix: forward signals to child process in npm launcher#347

Open
gtsiolis wants to merge 1 commit into
mainfrom
devx-942-node-wrapper-does-not-forward-signals-to-child-process-b667
Open

fix: forward signals to child process in npm launcher#347
gtsiolis wants to merge 1 commit into
mainfrom
devx-942-node-wrapper-does-not-forward-signals-to-child-process-b667

Conversation

@gtsiolis

Copy link
Copy Markdown
Member

The @localstack/lstk npm wrapper was auto-generated by goreleaser-npm-publisher and spawned the Go binary with no signal handlers. A programmatic kill <lstk-pid> killed the Node wrapper but left the Go binary running, orphaning mid-flight container starts. Interactive Ctrl-C only worked because the TTY signals the whole process group.

This ships our own launcher (npm/launcher.js) that resolves the platform binary from the installed optional dependency, forwards SIGINT/SIGTERM/SIGHUP to the child, and propagates the child's exit code / terminating signal.

Since that wrapper isn't customizable through the publishing action, the release job now runs goreleaser-npm-publisher build explicitly, overwrites the generated dist/npm/lstk/index.js with our launcher, then npm publishes each package — replacing the single evg4b/goreleaser-npm-publisher-action step. Platform packages are byte-identical to before; only the main package's wrapper changes.

A new test-launcher CI job runs node --test npm/*.test.js; the regression test spawns the launcher against a fake binary, sends SIGTERM, and asserts the child receives it and its exit code propagates out.

Note

The publish pipeline change only runs on tagged releases, so it can't be exercised by PR CI — worth a close look from a reviewer.

@gtsiolis gtsiolis marked this pull request as ready for review June 29, 2026 21:49
@gtsiolis gtsiolis requested a review from a team as a code owner June 29, 2026 21:49
@gtsiolis gtsiolis self-assigned this Jun 30, 2026
@gtsiolis gtsiolis added semver: patch docs: skip Pull request does not require documentation changes labels Jun 30, 2026
@gtsiolis gtsiolis force-pushed the devx-942-node-wrapper-does-not-forward-signals-to-child-process-b667 branch from 6f2d272 to f3adc03 Compare June 30, 2026 11:08
The npm wrapper auto-generated by goreleaser-npm-publisher spawned the
Go binary without installing any signal handlers. A programmatic
`kill <lstk-pid>` terminated the Node wrapper but left the Go binary
running, orphaning mid-flight container starts. Interactive Ctrl-C
worked only because the TTY signals the whole process group.

Ship our own launcher (npm/launcher.js) that resolves the platform
binary, forwards SIGINT/SIGTERM/SIGHUP to the child, and propagates its
exit code / terminating signal. The release job now builds the npm
packages, swaps in this launcher, and publishes — replacing the single
evg4b/goreleaser-npm-publisher-action step. A node --test job covers the
forwarding behaviour.

Generated with [Linear](https://linear.app/localstack/issue/DEVX-942/node-wrapper-does-not-forward-signals-to-child-process#agent-session-91e363a5)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@gtsiolis gtsiolis force-pushed the devx-942-node-wrapper-does-not-forward-signals-to-child-process-b667 branch from f3adc03 to 2ad4b7d Compare July 1, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: skip Pull request does not require documentation changes semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant