Skip to content

shell(exit): propagate last status on no-arg, fix negative/invalid arg codes - #34903

Open
robobun wants to merge 4 commits into
mainfrom
farm/b9e0b02e/shell-exit-status-mapping
Open

shell(exit): propagate last status on no-arg, fix negative/invalid arg codes#34903
robobun wants to merge 4 commits into
mainfrom
farm/b9e0b02e/shell-exit-status-mapping

test(shell/exit): use bunExe(), cover pipeline and subshell-inherit p…

058ab3c
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 21, 2026 in 15m 55s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/shell/builtin/exit.rs:33-36 exit with non-numeric first arg + extra args returns 1 instead of bash's 2

Annotations

Check warning on line 36 in src/runtime/shell/builtin/exit.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

exit with non-numeric first arg + extra args returns 1 instead of bash's 2

nit: `exit abc def` still returns 1 with "too many arguments" — bash checks arg[0]'s numeric-ness *before* argc, so it prints "numeric argument required" and exits 2. Before this PR both error paths returned 1 so the check order was unobservable in the exit code; splitting them into 2 vs 1 makes the divergence visible. Consider parsing `arg_bytes(0)` first whenever `argc >= 1` and only falling through to "too many arguments" if it parsed successfully.