-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
- Version: v6.2.1
- Platform: Linux rachmaninoff 4.5.3-1-ARCH deps: update openssl to 1.0.1j #1 SMP PREEMPT Sat May 7 20:43:57 CEST 2016 x86_64 GNU/Linux
- Subsystem: child-process
When the stdout of a spawned process is piped into a writable stream that doesn't read fast enough, and the spawned process exits, node will put it into flowing mode and data will be lost.
I have the following minimal testcase that pipes a simple child process to a PassThrough stream, and only after the process has exited the through stream is piped to node's stdout.
- Expected output: All numbers from 1 to 36000
- Actual output: On my machine it stops at around 32000
const spawn = require('child_process').spawn;
const stream = require('stream');
const through = new stream.PassThrough();
const p = spawn('seq', [ '36000' ]);
p.on('exit', function(code) {
setImmediate(function() {
through.pipe(process.stdout);
});
});
p.stdout.pipe(through);
Metadata
Metadata
Assignees
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.