Skip to content

fix(child_process): add execArgv support to spawn() - #65741

Open
dajiaohuang wants to merge 1 commit into
nodejs:mainfrom
dajiaohuang:fix/65725-spawn-execargv
Open

fix(child_process): add execArgv support to spawn()#65741
dajiaohuang wants to merge 1 commit into
nodejs:mainfrom
dajiaohuang:fix/65725-spawn-execargv

Conversation

@dajiaohuang

Copy link
Copy Markdown

Fix issue #65725 where spawn() silently ignores the execArgv option.

spawn() now correctly handles execArgv by prepending it to the args array, matching fork() behavior.

The execArgv option passed to spawn() was being silently ignored.
This commit adds proper handling of execArgv in normalizeSpawnArguments(),
prepending the execArgv values to the args array before argv0/file.

Fixes: nodejs#65725
PR-URL: nodejs#65726
@nodejs-github-bot nodejs-github-bot added child_process Issues and PRs related to the child_process subsystem. needs-ci PRs that need a full CI run. labels Sep 2, 2026
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.98%. Comparing base (09f5aae) to head (60e112d).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65741      +/-   ##
==========================================
+ Coverage   89.96%   89.98%   +0.02%     
==========================================
  Files         757      757              
  Lines      257376   257384       +8     
  Branches    48794    48794              
==========================================
+ Hits       231550   231619      +69     
+ Misses      16911    16846      -65     
- Partials     8915     8919       +4     
Files with missing lines Coverage Δ
lib/child_process.js 94.16% <100.00%> (+0.04%) ⬆️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Renegade334 Renegade334 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would imply that spawn() is just for creating Node.js processes. It's not, it's for arbitrary child processes, and Node.js CLI arguments should be passed positionally.

@MikeMcC399

Copy link
Copy Markdown
Contributor

Caution

AgentScan found account activity patterns that may be consistent with
automation. This is a heuristic, not proof that this pull request was
opened by an agent or violates policy. AI-assisted contributions are
permitted, but automated tooling must not open pull requests without
advance approval, and contributors must personally understand, test,
verify, and take responsibility for every submitted change. See the
AgentScan analysis,
AI use policy,
and
automation policy
for additional context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

child_process Issues and PRs related to the child_process subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants