@@ -448,6 +448,11 @@ function execFile(file, args = [], options, callback) {
448
448
child . stdout . setEncoding ( encoding ) ;
449
449
450
450
child . stdout . on ( 'data' , function onChildStdout ( chunk ) {
451
+ // Do not need to count the length
452
+ if ( options . maxBuffer === Infinity ) {
453
+ ArrayPrototypePush ( _stdout , chunk ) ;
454
+ return ;
455
+ }
451
456
const encoding = child . stdout . readableEncoding ;
452
457
const length = encoding ?
453
458
Buffer . byteLength ( chunk , encoding ) :
@@ -473,6 +478,11 @@ function execFile(file, args = [], options, callback) {
473
478
child . stderr . setEncoding ( encoding ) ;
474
479
475
480
child . stderr . on ( 'data' , function onChildStderr ( chunk ) {
481
+ // Do not need to count the length
482
+ if ( options . maxBuffer === Infinity ) {
483
+ ArrayPrototypePush ( _stderr , chunk ) ;
484
+ return ;
485
+ }
476
486
const encoding = child . stderr . readableEncoding ;
477
487
const length = encoding ?
478
488
Buffer . byteLength ( chunk , encoding ) :
@@ -487,7 +497,7 @@ function execFile(file, args = [], options, callback) {
487
497
ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER ( 'stderr' ) ;
488
498
kill ( ) ;
489
499
} else {
490
- _stderr . push ( chunk ) ;
500
+ ArrayPrototypePush ( _stderr , chunk ) ;
491
501
}
492
502
} ) ;
493
503
}
0 commit comments