fix(shell): builtin rm returns wrong exit code in quiet mode#27280
Merged
Jarred-Sumner merged 1 commit intomainfrom Mar 1, 2026
Merged
fix(shell): builtin rm returns wrong exit code in quiet mode#27280Jarred-Sumner merged 1 commit intomainfrom
rm returns wrong exit code in quiet mode#27280Jarred-Sumner merged 1 commit intomainfrom
Conversation
The `rm` builtin's `next()` function had a hardcoded `return this.bltn().done(0)` for the `.done` state, ignoring the exit code stored in `this.state.done.exit_code`. This caused `.quiet()` and `.text()` to always report exit code 0 for `rm` failures, since the quiet code path goes through `next()` rather than `onIOWriterChunk()`. Also fixed `onShellRmTaskDone` to use exit code 1 (matching POSIX convention) instead of the raw errno value. Closes #18161 Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
Author
Contributor
|
No actionable comments were generated in the recent review. 🎉 WalkthroughThis PR fixes exit code handling in the shell Changes
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Contributor
|
✅ 62323 — Looks good! Reviewed 2 files across |
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
rmreturning exit code 0 instead of 1 when a file doesn't exist and.quiet()or.text()is usednext()function had a hardcodeddone(0)that ignored the stored exit code, only affecting the quiet/pipe code pathonShellRmTaskDoneto use POSIX-conventional exit code 1 instead of raw errno valuesCloses #18161
Test plan
test/regression/issue/18161.test.tscovering:.quiet()throws onrmfailure.nothrow().quiet()returns non-zero exit code.text()throws onrmfailure.quiet()returns 0 on successfulrmUSE_SYSTEM_BUN=1(2 of 5 tests fail)bun bd testthrow.test.tstests passbunshell.test.tstests have no new failures (4 pre-existing quiet subprocess timeout failures)🤖 Generated with Claude Code