Skip to content

Commit 697d258

Browse files
aduh95Renegade334
andcommitted
doc: deprecate passing an empty string to options.shell
Co-authored-by: Renegade334 <[email protected]> PR-URL: #58564 Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 386c242 commit 697d258

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

doc/api/deprecations.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3824,6 +3824,29 @@ Instantiating classes without the `new` qualifier exported by the `node:http` mo
38243824
It is recommended to use the `new` qualifier instead. This applies to all http classes, such as
38253825
`OutgoingMessage`, `IncomingMessage`, `ServerResponse` and `ClientRequest`.
38263826

3827+
### DEP0196: Calling `node:child_process` functions with `options.shell` as an empty string
3828+
3829+
<!-- YAML
3830+
changes:
3831+
- version: REPLACEME
3832+
pr-url: https://github.com/nodejs/node/pull/58564
3833+
description: Documentation-only deprecation.
3834+
-->
3835+
3836+
Type: Documentation-only
3837+
3838+
Calling the process-spawning functions with `{ shell: '' }` is almost certainly
3839+
unintentional, and can cause aberrant behavior.
3840+
3841+
To make [`child_process.execFile`][] or [`child_process.spawn`][] invoke the
3842+
default shell, use `{ shell: true }`. If the intention is not to invoke a shell
3843+
(default behavior), either omit the `shell` option, or set it to `false` or a
3844+
nullish value.
3845+
3846+
To make [`child_process.exec`][] invoke the default shell, either omit the
3847+
`shell` option, or set it to a nullish value. If the intention is not to invoke
3848+
a shell, use [`child_process.execFile`][] instead.
3849+
38273850
[DEP0142]: #dep0142-repl_builtinlibs
38283851
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
38293852
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
@@ -3855,6 +3878,7 @@ It is recommended to use the `new` qualifier instead. This applies to all http c
38553878
[`asyncResource.runInAsyncScope()`]: async_context.md#asyncresourceruninasyncscopefn-thisarg-args
38563879
[`buffer.subarray`]: buffer.md#bufsubarraystart-end
38573880
[`child_process.execFile`]: child_process.md#child_processexecfilefile-args-options-callback
3881+
[`child_process.exec`]: child_process.md#child_processexeccommand-options-callback
38583882
[`child_process.spawn`]: child_process.md#child_processspawncommand-args-options
38593883
[`child_process`]: child_process.md
38603884
[`clearInterval()`]: timers.md#clearintervaltimeout

0 commit comments

Comments
 (0)