@@ -143,10 +143,9 @@ function normalizeExecArgs(command, options, callback) {
143
143
144
144
exports . exec = function exec ( command /* , options, callback */ ) {
145
145
var opts = normalizeExecArgs . apply ( null , arguments ) ;
146
- return exports . execFile (
147
- opts . file ,
148
- opts . options ,
149
- opts . callback ) ;
146
+ return exports . execFile ( opts . file ,
147
+ opts . options ,
148
+ opts . callback ) ;
150
149
} ;
151
150
152
151
const customPromiseExecFunction = ( orig ) => {
@@ -382,7 +381,7 @@ const _deprecatedCustomFds = deprecate(
382
381
return fd === - 1 ? 'pipe' : fd ;
383
382
} ) ;
384
383
} , 'child_process: options.customFds option is deprecated. ' +
385
- 'Use options.stdio instead.' , 'DEP0006' ) ;
384
+ 'Use options.stdio instead.' , 'DEP0006' ) ;
386
385
387
386
function _convertCustomFds ( options ) {
388
387
if ( options . customFds && ! options . stdio ) {
@@ -400,7 +399,7 @@ function normalizeSpawnArguments(file, args, options) {
400
399
if ( Array . isArray ( args ) ) {
401
400
args = args . slice ( 0 ) ;
402
401
} else if ( args !== undefined &&
403
- ( args === null || typeof args !== 'object' ) ) {
402
+ ( args === null || typeof args !== 'object' ) ) {
404
403
throw new ERR_INVALID_ARG_TYPE ( 'args' , 'object' , args ) ;
405
404
} else {
406
405
options = args ;
@@ -414,16 +413,15 @@ function normalizeSpawnArguments(file, args, options) {
414
413
415
414
// Validate the cwd, if present.
416
415
if ( options . cwd != null &&
417
- typeof options . cwd !== 'string' ) {
416
+ typeof options . cwd !== 'string' ) {
418
417
throw new ERR_INVALID_ARG_TYPE ( 'options.cwd' , 'string' , options . cwd ) ;
419
418
}
420
419
421
420
// Validate detached, if present.
422
421
if ( options . detached != null &&
423
- typeof options . detached !== 'boolean' ) {
424
- throw new ERR_INVALID_ARG_TYPE (
425
- 'options.detached' ,
426
- 'boolean' , options . detached ) ;
422
+ typeof options . detached !== 'boolean' ) {
423
+ throw new ERR_INVALID_ARG_TYPE ( 'options.detached' ,
424
+ 'boolean' , options . detached ) ;
427
425
}
428
426
429
427
// Validate the uid, if present.
@@ -438,35 +436,31 @@ function normalizeSpawnArguments(file, args, options) {
438
436
439
437
// Validate the shell, if present.
440
438
if ( options . shell != null &&
441
- typeof options . shell !== 'boolean' &&
442
- typeof options . shell !== 'string' ) {
443
- throw new ERR_INVALID_ARG_TYPE (
444
- 'options.shell' ,
445
- [ 'boolean' , 'string' ] , options . shell ) ;
439
+ typeof options . shell !== 'boolean' &&
440
+ typeof options . shell !== 'string' ) {
441
+ throw new ERR_INVALID_ARG_TYPE ( 'options.shell' ,
442
+ [ 'boolean' , 'string' ] , options . shell ) ;
446
443
}
447
444
448
445
// Validate argv0, if present.
449
446
if ( options . argv0 != null &&
450
- typeof options . argv0 !== 'string' ) {
447
+ typeof options . argv0 !== 'string' ) {
451
448
throw new ERR_INVALID_ARG_TYPE ( 'options.argv0' , 'string' , options . argv0 ) ;
452
449
}
453
450
454
451
// Validate windowsHide, if present.
455
452
if ( options . windowsHide != null &&
456
453
typeof options . windowsHide !== 'boolean' ) {
457
- throw new ERR_INVALID_ARG_TYPE (
458
- 'options.windowsHide' ,
459
- 'boolean' ,
460
- options . windowsHide ) ;
454
+ throw new ERR_INVALID_ARG_TYPE ( 'options.windowsHide' ,
455
+ 'boolean' , options . windowsHide ) ;
461
456
}
462
457
463
458
// Validate windowsVerbatimArguments, if present.
464
459
if ( options . windowsVerbatimArguments != null &&
465
- typeof options . windowsVerbatimArguments !== 'boolean' ) {
466
- throw new ERR_INVALID_ARG_TYPE (
467
- 'options.windowsVerbatimArguments' ,
468
- 'boolean' ,
469
- options . windowsVerbatimArguments ) ;
460
+ typeof options . windowsVerbatimArguments !== 'boolean' ) {
461
+ throw new ERR_INVALID_ARG_TYPE ( 'options.windowsVerbatimArguments' ,
462
+ 'boolean' ,
463
+ options . windowsVerbatimArguments ) ;
470
464
}
471
465
472
466
// Make a shallow copy so we don't clobber the user's options object.
@@ -588,10 +582,9 @@ function spawnSync(/* file, args, options */) {
588
582
} else if ( typeof input === 'string' ) {
589
583
pipe . input = Buffer . from ( input , options . encoding ) ;
590
584
} else {
591
- throw new ERR_INVALID_ARG_TYPE (
592
- `options.stdio[${ i } ]` ,
593
- [ 'Buffer' , 'Uint8Array' , 'string' ] ,
594
- input ) ;
585
+ throw new ERR_INVALID_ARG_TYPE ( `options.stdio[${ i } ]` ,
586
+ [ 'Buffer' , 'Uint8Array' , 'string' ] ,
587
+ input ) ;
595
588
}
596
589
}
597
590
}
@@ -667,10 +660,9 @@ function validateTimeout(timeout) {
667
660
668
661
function validateMaxBuffer ( maxBuffer ) {
669
662
if ( maxBuffer != null && ! ( typeof maxBuffer === 'number' && maxBuffer >= 0 ) ) {
670
- throw new ERR_OUT_OF_RANGE (
671
- 'options.maxBuffer' ,
672
- 'a positive number' ,
673
- maxBuffer ) ;
663
+ throw new ERR_OUT_OF_RANGE ( 'options.maxBuffer' ,
664
+ 'a positive number' ,
665
+ maxBuffer ) ;
674
666
}
675
667
}
676
668
@@ -679,9 +671,8 @@ function sanitizeKillSignal(killSignal) {
679
671
if ( typeof killSignal === 'string' || typeof killSignal === 'number' ) {
680
672
return convertToValidSignal ( killSignal ) ;
681
673
} else if ( killSignal != null ) {
682
- throw new ERR_INVALID_ARG_TYPE (
683
- 'options.killSignal' ,
684
- [ 'string' , 'number' ] ,
685
- killSignal ) ;
674
+ throw new ERR_INVALID_ARG_TYPE ( 'options.killSignal' ,
675
+ [ 'string' , 'number' ] ,
676
+ killSignal ) ;
686
677
}
687
678
}
0 commit comments