@@ -199,7 +199,13 @@ function normalizeExecArgs(command, options, callback) {
199
199
200
200
// Make a shallow copy so we don't clobber the user's options object.
201
201
options = { __proto__ : null , ...options } ;
202
- options . shell = typeof options . shell === 'string' ? options . shell : true ;
202
+
203
+ // Validate the shell, if present, otherwise request the default shell.
204
+ if ( options . shell != null && options . shell !== true ) {
205
+ validateString ( options . shell , 'options.shell' ) ;
206
+ } else {
207
+ options . shell = true ;
208
+ }
203
209
204
210
return {
205
211
file : command ,
@@ -613,11 +619,12 @@ function normalizeSpawnArguments(file, args, options) {
613
619
}
614
620
615
621
// Validate the shell, if present.
616
- if ( options . shell != null &&
617
- typeof options . shell !== 'boolean' &&
618
- typeof options . shell !== 'string' ) {
619
- throw new ERR_INVALID_ARG_TYPE ( 'options.shell' ,
620
- [ 'boolean' , 'string' ] , options . shell ) ;
622
+ if ( options . shell != null ) {
623
+ if ( typeof options . shell !== 'boolean' && typeof options . shell !== 'string' ) {
624
+ throw new ERR_INVALID_ARG_TYPE ( 'options.shell' ,
625
+ [ 'boolean' , 'string' ] , options . shell ) ;
626
+ }
627
+ validateArgumentNullCheck ( options . shell , 'options.shell' ) ;
621
628
}
622
629
623
630
// Validate argv0, if present.
@@ -639,7 +646,6 @@ function normalizeSpawnArguments(file, args, options) {
639
646
}
640
647
641
648
if ( options . shell ) {
642
- validateArgumentNullCheck ( options . shell , 'options.shell' ) ;
643
649
if ( args . length > 0 && ! emittedDEP0190Already ) {
644
650
process . emitWarning (
645
651
'Passing args to a child process with shell option true can lead to security ' +
0 commit comments