Skip to content

Commit b5a266e

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

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/child_process.js

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

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

163+
ArrayPrototypePushApply(newArgs, args);
164+
165+
args = newArgs;
162166
if (typeof options.stdio === 'string') {
163167
options.stdio = stdioStringToArray(options.stdio, 'ipc');
164168
} else if (!ArrayIsArray(options.stdio)) {
@@ -648,7 +652,8 @@ function normalizeSpawnArguments(file, args, options) {
648652
'DEP0190');
649653
emittedDEP0190Already = true;
650654
}
651-
const command = ArrayPrototypeJoin([file, ...args], ' ');
655+
656+
const command = args.length > 0 ? `${file} ${ArrayPrototypeJoin(args, ' ')}` : file;
652657
// Set the shell, switches, and commands.
653658
if (process.platform === 'win32') {
654659
if (typeof options.shell === 'string')

0 commit comments

Comments
 (0)