Repository navigation
fix(node_shim): preserve explicit argument delimiters - #36435
bartlomieju merged 2 commits into
Conversation
bartlomieju
left a comment
There was a problem hiding this comment.
Correct fix. Dropping -- during parsing made node -- eval foo.js indistinguishable from node eval foo.js, so the is_deno_subcommand passthrough would hijack it and run deno eval instead of a script named eval. Gating that passthrough on !had_double_dash is the right call — after an explicit --, Node treats the next argument as the script name unconditionally, so there's nothing to sniff.
Checked that append_remaining_args is applied at all four deno_args.extend(parsed_args.remaining_args) sites (task, the middle branch, and the final script path), so no branch silently drops the delimiter. Guarding on !remaining_args.is_empty() avoids emitting a trailing bare --.
Both new tests pin the cases that actually mattered: a subcommand-looking script name, and a flag-looking script name that would otherwise be eaten by deno run. LGTM.
Summary
--Details
Node argument parsing removes the option delimiter before translation, which previously made explicitly-delimited arguments indistinguishable from ordinary remaining arguments. The parse result now retains that state so translated task, test, and script invocations preserve the original positional-argument boundary. Deno-style subcommand passthrough remains available only on the existing no-delimiter path.
Validation
./tools/format.js libs/node_shim/lib.rs --checkcargo test -p node_shim -- --nocapturecargo check -p node_shim --all-targetscargo check -p deno_node --features deno_core/v8