◐ Shell
clean mode source ↗

child_process: remove unsafe array iteration · nodejs/node@e13de45

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')