Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e87cd45

Browse filesBrowse files
Ayase-252targos
authored andcommitted
child_process: refactor to use validateBoolean
PR-URL: #38927 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 651c58b commit e87cd45
Copy full SHA for e87cd45

File tree

Expand file treeCollapse file tree

1 file changed

+8
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-13
lines changed
Open diff view settings
Collapse file

‎lib/child_process.js‎

Copy file name to clipboardExpand all lines: lib/child_process.js
+8-13Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const { getValidatedPath } = require('internal/fs/utils');
7575
const {
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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.