Skip to content

doc: remove spawn with shell example from bat/cmd section#62243

Open
kovan wants to merge 2 commits intonodejs:mainfrom
kovan:doc/bat-cmd-spawn-deprecation
Open

doc: remove spawn with shell example from bat/cmd section#62243
kovan wants to merge 2 commits intonodejs:mainfrom
kovan:doc/bat-cmd-spawn-deprecation

Conversation

@kovan
Copy link
Contributor

@kovan kovan commented Mar 13, 2026

Remove the suggestion to use child_process.spawn() with the shell
option for running .bat and .cmd files on Windows. Passing arguments
through spawn with shell: true is deprecated (DEP0190) due to
shell injection risks. The exec() and direct cmd.exe spawn
alternatives remain documented.

Continues the work from #58739 which addressed the same issue but
stale-closed without review.

Fixes: #58735

Remove the suggestion to use child_process.spawn() with the shell
option set for running .bat and .cmd files on Windows. Passing
arguments through spawn with shell: true is deprecated (DEP0190)
due to shell injection risks. Keep the exec() and direct cmd.exe
spawn alternatives.

Fixes: nodejs#58735
@nodejs-github-bot nodejs-github-bot added child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations. labels Mar 13, 2026
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
terminal, and therefore cannot be launched using [`child_process.execFile()`][].
When running on Windows, `.bat` and `.cmd` files can be invoked by:

* using [`child_process.spawn()`][] with the `shell` option set, or
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add it back, along with the link to the deps:

* using [`child_process.spawn()`][] with the `shell` option set (not recommended, see [DEP0190][]), or

Comment on lines +129 to +131
Using [`child_process.spawn()`][] with the `shell` option is not recommended
because passing arguments that way is deprecated ([DEP0190][]).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this addition is kinda confusing as the shell option by itself is not deprecated – though I agree on the "not recommended" point, and removing it from the examples is fine. If you take my other suggestion, I think we can remove it

Suggested change
Using [`child_process.spawn()`][] with the `shell` option is not recommended
because passing arguments that way is deprecated ([DEP0190][]).

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. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conflict between child_process API guidance and DEP0190

3 participants