cli: handle -v/--version in the node argv0 shim - #36128
Open
robobun wants to merge 4 commits into
Open
Claude / Claude Code Review
completed
Jul 27, 2026 in 13m 50s
Code review found 2 potential issues
Found 2 candidates, confirmed 2. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 2 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/runtime/cli/mod.rs:1532-1539 |
Scan breaks on the value of a preceding option; node -r ./x --version still fails |
| 🟡 Nit | src/runtime/cli/mod.rs:1532-1539 |
Lone '-' (stdin sentinel) not treated as positional; node - --version is intercepted |
Annotations
Check warning on line 1539 in src/runtime/cli/mod.rs
claude / Claude Code Review
Scan breaks on the value of a preceding option; node -r ./x --version still fails
The scan breaks on the first non-dash arg, but for value-taking flags in `RUN_TABLE` (`-r/--require`, `--import`, `--title`, `--conditions`, ...) that arg is the flag's *value* — so `node -r ./preload.js --version` breaks on `./preload.js`, never sees `--version`, and still exits 1 with "Missing script". This also bites bare `node -v` when `BUN_OPTIONS='-r ./x'` is set, since those tokens are spliced into argv after argv[0]. Not a regression (same behavior before this PR), so non-blocking — but
Check warning on line 1539 in src/runtime/cli/mod.rs
claude / Claude Code Review
Lone '-' (stdin sentinel) not treated as positional; node - --version is intercepted
The lone `-` (stdin sentinel) is not treated as a positional here — `a.first() != Some(&b'-')` is false for `b"-"`, so the loop continues past it and `node - --version` now prints the Node version instead of erroring/passing `--version` to the stdin script. Bun's own clap classifier already special-cases `b"-"` as `ArgKind::Positional` (streaming.rs:306), and real Node passes the flag through; add a `b"-" => break` arm alongside `b"--"`.
Loading