Skip to content

Bun.spawn/spawnSync, Bun.which: inherit live process.env instead of the startup snapshot - #34972

Open
robobun wants to merge 7 commits into
mainfrom
claude/farm/68b2c3e5/spawn-default-env-live-process-env
Open

Bun.spawn/spawnSync, Bun.which: inherit live process.env instead of the startup snapshot#34972
robobun wants to merge 7 commits into
mainfrom
claude/farm/68b2c3e5/spawn-default-env-live-process-env

test: assert combined {stdout, stderr, exitCode} for better failure d…

92b1f55
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 21, 2026 in 25m 41s

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/api/bun/js_bun_spawn_bindings.rs:615-628 Duplicated process.env-inheritance block in spawn_maybe_sync

Annotations

Check warning on line 628 in src/runtime/api/bun/js_bun_spawn_bindings.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

Duplicated process.env-inheritance block in spawn_maybe_sync

The two new no-`env:` fallback blocks (here and at ~lines 909–921 in the no-options branch) are byte-identical: `process_env_object()?` → `ensure_still_alive()` → `if let Some(object) { append_envp_from_js(...) }`. REVIEW.md → "Code style & idioms" says: *"The second time a multi-line block appears in your diff, extract a named helper and use it at EVERY parallel site."* A local helper like `inherit_process_env(global_this, &mut env_array, &mut path, &mut cstr_storage)?` would keep the two branc