Skip to content

Commit e50526a

Browse files
committed
lib: use primordial
replace spread operator with priordial
1 parent cd1a90d commit e50526a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/child_process.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,14 @@ function fork(modulePath, args = [], options) {
157157
}
158158
}
159159

160-
args = [...execArgv, modulePath, ...args];
160+
const newArgs = ArrayPrototypeSlice(execArgv);
161+
ArrayPrototypePush(newArgs, modulePath);
161162

163+
for (let i = 0; i < args.length; i++) {
164+
ArrayPrototypePush(newArgs, args[i]);
165+
}
166+
167+
args = newArgs;
162168
if (typeof options.stdio === 'string') {
163169
options.stdio = stdioStringToArray(options.stdio, 'ipc');
164170
} else if (!ArrayIsArray(options.stdio)) {
@@ -648,7 +654,9 @@ function normalizeSpawnArguments(file, args, options) {
648654
'DEP0190');
649655
emittedDEP0190Already = true;
650656
}
651-
const command = ArrayPrototypeJoin([file, ...args], ' ');
657+
const cmdArgs = ArrayPrototypeSlice(args);
658+
ArrayPrototypeUnshift(cmdArgs, file);
659+
const command = ArrayPrototypeJoin(cmdArgs, ' ');
652660
// Set the shell, switches, and commands.
653661
if (process.platform === 'win32') {
654662
if (typeof options.shell === 'string')

0 commit comments

Comments
 (0)