Skip to content

child_process: options.shell validation #58525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Renegade334
Copy link
Contributor

Based on an original PR at #54623, with modifications based on #56761 (comment).

child_process: validate exec's options.shell as string

While execFile and spawn perform validation on options.shell, exec just silently ignores invalid values without raising any error. This changes that behaviour to an explicit validation.

child_process: deprecate passing options.shell as empty string

Passing { shell: '' } to the process creation functions should never be intentional, and doing so has some funky behaviour:

  • when passed to execFile/spawn: is equivalent to { shell: false }
  • when passed to exec: breaks out of exec's shell-based behaviour and instead spawns the process directly, interpreting command as a file path

This adds a pending deprecation for this case.

@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 May 31, 2025
Copy link

codecov bot commented May 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.23%. Comparing base (705bcc2) to head (b3322f3).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #58525   +/-   ##
=======================================
  Coverage   90.22%   90.23%           
=======================================
  Files         635      635           
  Lines      187653   187596   -57     
  Branches    36867    36858    -9     
=======================================
- Hits       169310   169268   -42     
- Misses      11101    11103    +2     
+ Partials     7242     7225   -17     
Files with missing lines Coverage Δ
lib/child_process.js 97.78% <100.00%> (+0.03%) ⬆️

... and 33 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.

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.

2 participants