Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

child_process.flushStdio: resume _consuming streams #4071

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
13 changes: 13 additions & 0 deletions test/parallel/test-child-process-flush-stdio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';
const cp = require('child_process');
const common = require('../common');

var p = cp.spawn('echo');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please make this const.


p.on('close', common.mustCall(function() {}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an assertion that the close arguments are what is expected.


p.stdout.read();

setTimeout(function() {
p.kill();
}, 100);