@@ -62,6 +62,7 @@ const {
62
62
validateString,
63
63
isInt32,
64
64
validateAbortSignal,
65
+ validateBoolean,
65
66
} = require ( 'internal/validators' ) ;
66
67
const child_process = require ( 'internal/child_process' ) ;
67
68
const {
@@ -463,10 +464,8 @@ function normalizeSpawnArguments(file, args, options) {
463
464
}
464
465
465
466
// Validate detached, if present.
466
- if ( options . detached != null &&
467
- typeof options . detached !== 'boolean' ) {
468
- throw new ERR_INVALID_ARG_TYPE ( 'options.detached' ,
469
- 'boolean' , options . detached ) ;
467
+ if ( options . detached != null ) {
468
+ validateBoolean ( options . detached , 'options.detached' ) ;
470
469
}
471
470
472
471
// Validate the uid, if present.
@@ -494,19 +493,15 @@ function normalizeSpawnArguments(file, args, options) {
494
493
}
495
494
496
495
// Validate windowsHide, if present.
497
- if ( options . windowsHide != null &&
498
- typeof options . windowsHide !== 'boolean' ) {
499
- throw new ERR_INVALID_ARG_TYPE ( 'options.windowsHide' ,
500
- 'boolean' , options . windowsHide ) ;
496
+ if ( options . windowsHide != null ) {
497
+ validateBoolean ( options . windowsHide , 'options.windowsHide' ) ;
501
498
}
502
499
503
500
// Validate windowsVerbatimArguments, if present.
504
501
let { windowsVerbatimArguments } = options ;
505
- if ( windowsVerbatimArguments != null &&
506
- typeof windowsVerbatimArguments !== 'boolean' ) {
507
- throw new ERR_INVALID_ARG_TYPE ( 'options.windowsVerbatimArguments' ,
508
- 'boolean' ,
509
- windowsVerbatimArguments ) ;
502
+ if ( windowsVerbatimArguments != null ) {
503
+ validateBoolean ( windowsVerbatimArguments ,
504
+ 'options.windowsVerbatimArguments' ) ;
510
505
}
511
506
512
507
if ( options . shell ) {
0 commit comments