@@ -75,6 +75,7 @@ const { getValidatedPath } = require('internal/fs/utils');
7575const {
7676 isInt32,
7777 validateAbortSignal,
78+ validateBoolean,
7879 validateObject,
7980 validateString,
8081} = require ( 'internal/validators' ) ;
@@ -459,10 +460,8 @@ function normalizeSpawnArguments(file, args, options) {
459460 }
460461
461462 // Validate detached, if present.
462- if ( options . detached != null &&
463- typeof options . detached !== 'boolean' ) {
464- throw new ERR_INVALID_ARG_TYPE ( 'options.detached' ,
465- 'boolean' , options . detached ) ;
463+ if ( options . detached != null ) {
464+ validateBoolean ( options . detached , 'options.detached' ) ;
466465 }
467466
468467 // Validate the uid, if present.
@@ -489,19 +488,15 @@ function normalizeSpawnArguments(file, args, options) {
489488 }
490489
491490 // Validate windowsHide, if present.
492- if ( options . windowsHide != null &&
493- typeof options . windowsHide !== 'boolean' ) {
494- throw new ERR_INVALID_ARG_TYPE ( 'options.windowsHide' ,
495- 'boolean' , options . windowsHide ) ;
491+ if ( options . windowsHide != null ) {
492+ validateBoolean ( options . windowsHide , 'options.windowsHide' ) ;
496493 }
497494
498495 // Validate windowsVerbatimArguments, if present.
499496 let { windowsVerbatimArguments } = options ;
500- if ( windowsVerbatimArguments != null &&
501- typeof windowsVerbatimArguments !== 'boolean' ) {
502- throw new ERR_INVALID_ARG_TYPE ( 'options.windowsVerbatimArguments' ,
503- 'boolean' ,
504- windowsVerbatimArguments ) ;
497+ if ( windowsVerbatimArguments != null ) {
498+ validateBoolean ( windowsVerbatimArguments ,
499+ 'options.windowsVerbatimArguments' ) ;
505500 }
506501
507502 if ( options . shell ) {
0 commit comments