Skip to content

fix(cli): apply supported NODE_OPTIONS before command-line arguments - #73

Merged
steipete merged 1 commit into
mainfrom
claude/w67-node-options-preloads
Oct 2, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/w67-node-options-preloads

Conversation

@steipete

@steipete steipete commented Oct 2, 2026 •

Copy link
Copy Markdown

Bun ignored NODE_OPTIONS, so a child launched with an environment --require preload ran without its startup hook even though the equivalent command-line preload worked. This breaks process-manager fixtures and real tools that propagate startup configuration through the environment.

Ports the open upstream oven-sh/bun#40328, with credit to @robobun. Parse Node's quoting and escaping rules, apply the Node flags Bun implements before ordinary command-line arguments, and keep injected tokens out of process.execArgv. Update raw-argv consumers so environment options cannot shift subcommand arguments or compiled-app passthrough. The init regression uses declared dependencies and a local registry to remain hermetic.

This is the upstream port's documented partial support: unsupported Node flags remain ignored, disallowed flags warn and are ignored, and node_without_node_options stays true. Supported preload behavior follows Node 24, including environment-before-argv ordering and require-before-import ordering.

The standalone Node 24.21.0 oracle verifies a quoted preload path, mixed environment/CLI preloads, and unmodified execArgv; unpatched Bun fails it. The AWS Linux release build passes 273 tests across the new environment suite, BUN_OPTIONS, preload, and process suites (5 skips, 3 existing todo, zero failures; 2.02 seconds). The identical quoted-path/order/execArgv oracle now matches Node 24. All 12 Rust targets pass, and the scoped P2 branch review is clean. Exact-head Linux/macOS CI gates landing.

Ports oven-sh#40328 by @robobun. Keep the init regression hermetic with declared dependencies and a local registry.
@steipete
steipete force-pushed the claude/w67-node-options-preloads branch from 5ff3580 to 05b75d4 Compare October 2, 2026 07:40
@steipete
steipete merged commit ea02fee into main Oct 2, 2026
11 checks passed
@steipete
steipete deleted the claude/w67-node-options-preloads branch October 2, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant