Skip to content

cli: classify the subcommand past --cwd/--env-file values - #36644

Open
robobun wants to merge 9 commits into
mainfrom
farm/07fabac3/which-global-flag-value
Open

cli: classify the subcommand past --cwd/--env-file values#36644
robobun wants to merge 9 commits into
mainfrom
farm/07fabac3/which-global-flag-value

test: skipIf(isWindows) for shebang bin stub; clarify bunx --cwd comment

506da7e
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Aug 1, 2026 in 34m 39s

Code review found 1 important issue

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

Details

Severity Count
🔴 Important 1
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/cli/mod.rs:803-815 apply_leading_cwd() applies first --cwd; every other parser applies last

Annotations

Check warning on line 815 in src/runtime/cli/mod.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

apply_leading_cwd() applies first --cwd; every other parser applies last

`apply_leading_cwd()` returns after the **first** `--cwd` match, so `bun --cwd a --cwd b init -y` chdirs to `a/`; every other `--cwd` consumer (`arguments::parse`, `CommandLineArguments::parse`) uses bun_clap's last-wins semantics and would chdir to `b/`. Track the last-seen `dir` in a local and chdir once after the loop instead of `return`ing on match — that keeps init/bunx/create consistent with run/test/install on repeated `--cwd`.