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: #39536)

PR-URL: #39547
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
VoltrexKeyva authored and danielleadams committed Aug 16, 2021
1 parent 486d51a commit be2d60d
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 be2d60d

Please sign in to comment.