Skip to content

Commit 208bc81

Browse files
hotpineapplerichardlau
authored andcommitted
child_process: remove unsafe array iteration
PR-URL: #59347 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent a2d2003 commit 208bc81

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎lib/child_process.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,8 @@ function normalizeSpawnArguments(file, args, options) {
639639

640640
if(options.shell){
641641
validateArgumentNullCheck(options.shell,'options.shell');
642-
constcommand=ArrayPrototypeJoin([file, ...args],' ');
642+
643+
constcommand=args.length>0 ? `${file}${ArrayPrototypeJoin(args,' ')}` : file;
643644
// Set the shell, switches, and commands.
644645
if(process.platform==='win32'){
645646
if(typeofoptions.shell==='string')

0 commit comments

Comments
 (0)