Skip to content

fix: propagate wrapped subcommand exit codes#11294

Open
saschabuehrle wants to merge 1 commit intostdlib-js:developfrom
saschabuehrle:fix/issue-11293-exit-code
Open

fix: propagate wrapped subcommand exit codes#11294
saschabuehrle wants to merge 1 commit intostdlib-js:developfrom
saschabuehrle:fix/issue-11293-exit-code

Conversation

@saschabuehrle
Copy link
Copy Markdown

Fixes #11293

The wrapper was only handling process spawn errors, so non-zero exits from the delegated command were lost. This wires the child process close event and exits with the same status (or forwards the signal) so wrapper behavior matches direct command execution.

Greetings, saschabuehrle

@stdlib-bot
Copy link
Copy Markdown
Contributor

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

Getting Started

Next Steps

  1. A project maintainer will approve GitHub Actions workflows for your PR.
  2. All CI checks must pass before your submission can be fully reviewed.
  3. You'll need to address any failures in linting or unit tests.

Running Tests Locally

You can use make to run any of the CI commands locally from the root directory of the stdlib repository:

# Run tests for all packages in the math namespace:
make test TESTS_FILTER=".*/@stdlib/math/.*"

# Run benchmarks for a specific package:
make benchmark BENCHMARKS_FILTER=".*/@stdlib/math/base/special/sin/.*"

If you haven't heard back from us within two weeks, please ping us by tagging the "reviewers" team in a comment on this PR.

If you have any further questions while waiting for a response, please join our Zulip community to chat with project maintainers and other community members.

We appreciate your contribution!

Documentation Links

@stdlib-bot stdlib-bot added the First-time Contributor A pull request from a contributor who has never previously committed to the project repository. label Apr 4, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Apr 4, 2026
@github-actions github-actions bot mentioned this pull request Apr 4, 2026
@Vipeen-Kumar
Copy link
Copy Markdown
Contributor

Hey @saschabuehrle — thanks for the quick fix!
Two small, optional suggestions:

Use process.execPath instead of 'node' in spawn(...) so the child uses the same Node binary as the parent.
Consider process.exitCode = code instead of process.exit(code || 0) to avoid forcing immediate termination and allow pending cleanup/log flushes.

Also, looks like check_contributing_guidelines_acceptance is failing due to the missing contributing-guidelines checkbox in the PR description.

@kgryte
Copy link
Copy Markdown
Member

kgryte commented Apr 5, 2026

Consider process.exitCode = code instead of process.exit(code || 0) to avoid forcing immediate termination and allow pending cleanup/log flushes.

Better would be to use the corresponding cli APIs. See https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/cli/ctor.

@kgryte
Copy link
Copy Markdown
Member

kgryte commented Apr 5, 2026

Use process.execPath instead of 'node' in spawn(...) so the child uses the same Node binary as the parent.

@Vipeen-Kumar This is a separate issue and not applicable to the upstream issue which this PR is intended to address. Please ensure that whatever LLM code review you are running is actually tailored and scoped to the issue at hand.

@Vipeen-Kumar
Copy link
Copy Markdown
Contributor

@kgryte Thanks for calling that out — you’re right.
I went a bit beyond the scope of what this PR is trying to fix. Sorry for the noise 🙏
I’ll keep my review comments tighter and focused on the issue at hand going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI wrapper swallows subcommand exit codes

4 participants