shell(exit): propagate last status on no-arg, fix negative/invalid arg codes - #34903
Open
robobun wants to merge 4 commits into
Open
shell(exit): propagate last status on no-arg, fix negative/invalid arg codes#34903robobun wants to merge 4 commits into
robobun wants to merge 4 commits into
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
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.
Loading