Skip to content

Commit e13de45

Browse files
hotpineappletargos
authored andcommitted
child_process: remove unsafe array iteration
PR-URL: #59347 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 4fe383e commit e13de45

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/child_process.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,8 @@ function normalizeSpawnArguments(file, args, options) {
648648
'DEP0190');
649649
emittedDEP0190Already = true;
650650
}
651-
const command = ArrayPrototypeJoin([file, ...args], ' ');
651+
652+
const command = args.length > 0 ? `${file} ${ArrayPrototypeJoin(args, ' ')}` : file;
652653
// Set the shell, switches, and commands.
653654
if (process.platform === 'win32') {
654655
if (typeof options.shell === 'string')

0 commit comments

Comments
 (0)