Skip to content

Commit a470f2c

Browse files
committed
child_process: skip count length when maxBuffer is Infinity
1 parent ba67fe6 commit a470f2c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/child_process.js

+10
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,11 @@ function execFile(file, args = [], options, callback) {
437437
child.stdout.setEncoding(encoding);
438438

439439
child.stdout.on('data', function onChildStdout(chunk) {
440+
// Skip count the length
441+
if (options.maxBuffer === Infinity) {
442+
ArrayPrototypePush(_stdout, chunk);
443+
return;
444+
}
440445
const encoding = child.stdout.readableEncoding;
441446
const length = encoding ?
442447
Buffer.byteLength(chunk, encoding) :
@@ -462,6 +467,11 @@ function execFile(file, args = [], options, callback) {
462467
child.stderr.setEncoding(encoding);
463468

464469
child.stderr.on('data', function onChildStderr(chunk) {
470+
// Skip count the length
471+
if (options.maxBuffer === Infinity) {
472+
_stderr.push(chunk);
473+
return;
474+
}
465475
const encoding = child.stderr.readableEncoding;
466476
const length = encoding ?
467477
Buffer.byteLength(chunk, encoding) :

0 commit comments

Comments
 (0)