DEP0196:调用 node:child_process 函数时,options.shell 为空字符串


¥DEP0196: Calling node:child_process functions with options.shell as an empty string

类型:仅文档

¥Type: Documentation-only

使用 { shell: '' } 调用进程生成函数几乎肯定是无意的,并且可能导致异常行为。

¥Calling the process-spawning functions with { shell: '' } is almost certainly unintentional, and can cause aberrant behavior.

要使 child_process.execFilechild_process.spawn 调用默认 shell,请使用 { shell: true }。如果不打算调用 shell(默认行为),请省略 shell 选项,或将其设置为 false 或空值。

¥To make child_process.execFile or child_process.spawn invoke the default shell, use { shell: true }. If the intention is not to invoke a shell (default behavior), either omit the shell option, or set it to false or a nullish value.

要使 child_process.exec 调用默认 shell,请省略 shell 选项,或将其设置为空值。如果不打算调用 shell,请改用 child_process.execFile

¥To make child_process.exec invoke the default shell, either omit the shell option, or set it to a nullish value. If the intention is not to invoke a shell, use child_process.execFile instead.