-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
🚀 New features to boost your workflow:
|
### DEP0195: Calling `node:child_process` functions with `options.shell` as an empty string | ||
|
||
<!-- YAML | ||
changes: | ||
- version: REPLACEME | ||
pr-url: https://github.com/nodejs/node/pull/58525 | ||
description: Documentation-only deprecation | ||
with `--pending-deprecation` support. | ||
--> | ||
|
||
Type: Documentation-only (supports [`--pending-deprecation`][]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you start with a doc-deprecation that can land earlier? Doc-only changes do not need full CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR contains the validation changes as well in a sequential commit, so would need CI anyway unless it were split out into separate PRs.
It feels like this should be a candidate for early warnings – using exec with shell: ''
can completely change the execution target (eg. commands containing spaces or other metacharacters), but will equally sometimes not be noticeable, which seems spooky enough to warrant --pending-deprecation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was meaning a separate PR yes, I can open it for you if that's OK
EDIT: Done in #58564
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll rebase onto that once it gets merged.
Based on an original PR at #54623, with modifications based on #56761 (comment).
child_process: validate exec's
options.shell
as stringWhile 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 stringPassing
{ shell: '' }
to the process creation functions should never be intentional, and doing so has some funky behaviour:{ shell: false }
command
as a file pathThe doc-deprecation itself was split out into a separate PR, and so this adds
--pending-deprecation
behaviour on top.Refs: #58564