-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
In some cases writable streams emit an error event after having already emitted a finish event.
This is inconsistent with older versions, and also breaks code that removes all event listeners on the finish event.
Consider the js code below. In version v8.1.1 the output is:
finish
error
In node version v6.9.5 and v4.2.6 the output is:
error
uname -a
Linux xxxx 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux
var stream = require('stream');
var rs = new stream.Readable();
rs.push('ok');
rs.push(null);
rs._read = () => { };
var ws = new stream.Writable();
ws.on('finish', () => { console.log('finish'); });
ws.on('error', () => { console.log('error'); });
ws._write = (chunk, encoding, done) => {
setImmediate(() => { done(new Error()); });
};
rs.pipe(ws);
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.