fix(npm): propagate CLI exit code from npm wrapper (related to #214) - #268
Open
stantheman0128 wants to merge 1 commit into
Open
fix(npm): propagate CLI exit code from npm wrapper (related to #214)#268stantheman0128 wants to merge 1 commit into
stantheman0128 wants to merge 1 commit into
Conversation
execFileSync throws when the binary exits non-zero, so `npx zeabur` printed a Node stack trace and always exited 1. That hides the exit code that `service exec` and `server exec` deliberately return from the remote command, which breaks scripting and CI usage. spawnSync returns the status instead of throwing, so the wrapper can forward it unchanged and report a spawn failure in a single line. Co-authored-by: Cursor <[email protected]>
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.
Summary
Related to #214. The quoting half of that issue was already fixed in merged #215 (
execFileSyncwith argv array). This PR addresses the residual exit-code propagation when the npm wrapper shells out to the platform binary.execFileSyncthrows on non-zero CLI exit, sonpx zeabur service exec(and similar) printed a Node stack trace and always exited1, discarding deliberate exit codes from commands likeinternal/cmd/service/exec/exec.goandinternal/cmd/server/exec/exec.go.Switch to
spawnSync+process.exitCodeso the wrapper forwards the binary's status (including signal-terminated runs).AI disclosure
AI-assisted patch; human-reviewed by Stan Shih (stantheman0128) before publish.
Verification / Evidence
Windows 11, fake binary harness (same argv-preservation cases as #214 discussion):
Published npm 0.21.0 tarball on registry also carries the #215 argv fix; this PR is only the exit-code half.
What was not tested
npx zeaburagainst a remote Zeabur API (local fake-binary harness only).Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.