@@ -458,6 +458,11 @@ function execFile(file, args, options, callback) {
458
458
child . stdout . setEncoding ( encoding ) ;
459
459
460
460
child . stdout . on ( 'data' , function onChildStdout ( chunk ) {
461
+ // Do not need to count the length
462
+ if ( options . maxBuffer === Infinity ) {
463
+ ArrayPrototypePush ( _stdout , chunk ) ;
464
+ return ;
465
+ }
461
466
const encoding = child . stdout . readableEncoding ;
462
467
const length = encoding ?
463
468
Buffer . byteLength ( chunk , encoding ) :
@@ -483,6 +488,11 @@ function execFile(file, args, options, callback) {
483
488
child . stderr . setEncoding ( encoding ) ;
484
489
485
490
child . stderr . on ( 'data' , function onChildStderr ( chunk ) {
491
+ // Do not need to count the length
492
+ if ( options . maxBuffer === Infinity ) {
493
+ ArrayPrototypePush ( _stderr , chunk ) ;
494
+ return ;
495
+ }
486
496
const encoding = child . stderr . readableEncoding ;
487
497
const length = encoding ?
488
498
Buffer . byteLength ( chunk , encoding ) :
@@ -497,7 +507,7 @@ function execFile(file, args, options, callback) {
497
507
ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER ( 'stderr' ) ;
498
508
kill ( ) ;
499
509
} else {
500
- _stderr . push ( chunk ) ;
510
+ ArrayPrototypePush ( _stderr , chunk ) ;
501
511
}
502
512
} ) ;
503
513
}
0 commit comments