Skip to content

Commit

Permalink
lib: use validator
Browse files Browse the repository at this point in the history
Used the `validateArray()` validator for array validation
for consistency. (Refs: nodejs#39536)
  • Loading branch information
VoltrexKeyva authored Jul 27, 2021
1 parent 5ad6a99 commit 3803072
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,8 @@ ChildProcess.prototype.spawn = function(options) {
// Let child process know about opened IPC channel
if (options.envPairs === undefined)
options.envPairs = [];
else if (!ArrayIsArray(options.envPairs)) {
throw new ERR_INVALID_ARG_TYPE('options.envPairs',
'Array',
options.envPairs);
}
else
validateArray(options.envPairs, 'options.envPairs');

ArrayPrototypePush(options.envPairs, `NODE_CHANNEL_FD=${ipcFd}`);
ArrayPrototypePush(options.envPairs,
Expand Down

0 comments on commit 3803072

Please sign in to comment.