diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index 6f396fac6c95e6..cd5313d65ce457 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -217,7 +217,7 @@ util.inherits(ChildProcess, EventEmitter); function flushStdio(subprocess) { if (subprocess.stdio == null) return; subprocess.stdio.forEach(function(stream, fd, stdio) { - if (!stream || !stream.readable || stream._consuming) + if (!stream || !stream.readable) return; stream.resume(); }); diff --git a/test/sequential/test-child-process-flush-stdio.js b/test/sequential/test-child-process-flush-stdio.js new file mode 100644 index 00000000000000..743fc2c465355f --- /dev/null +++ b/test/sequential/test-child-process-flush-stdio.js @@ -0,0 +1,13 @@ +'use strict'; +const cp = require('child_process'); +const common = require('../common'); + +var p = cp.spawn('yes'); + +p.on('close', common.mustCall(function() {})); + +p.stdout.read(); + +setTimeout(function() { + p.kill(); +}, 100);