From be2d60dd1d4b5edd5bf1dbb34b1734171fad88a1 Mon Sep 17 00:00:00 2001 From: Voltrex Date: Tue, 27 Jul 2021 20:34:32 +0430 Subject: [PATCH] lib: use validator Used the `validateArray()` validator for array validation for consistency. (Refs: #39536) PR-URL: https://github.com/nodejs/node/pull/39547 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Darshan Sen --- lib/internal/child_process.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 7ff0832538f1e7..d46a5ce03f09c6 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -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,