0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00

Revert "stream: remove ambiguous code"

This reverts commit ce62e963a1.

PR-URL: https://github.com/nodejs/node/pull/29717
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
This commit is contained in:
Matteo Collina 2019-10-09 19:52:32 +02:00
parent 768287489a
commit 8c60685105

View File

@ -59,9 +59,9 @@ function eos(stream, opts, callback) {
};
}
const readable = opts.readable ||
let readable = opts.readable ||
(opts.readable !== false && isReadable(stream));
const writable = opts.writable ||
let writable = opts.writable ||
(opts.writable !== false && isWritable(stream));
const onlegacyfinish = () => {
@ -69,13 +69,15 @@ function eos(stream, opts, callback) {
};
const onfinish = () => {
writable = false;
writableFinished = true;
if (!readable || readableEnded) callback.call(stream);
if (!readable) callback.call(stream);
};
const onend = () => {
readable = false;
readableEnded = true;
if (!writable || writableFinished) callback.call(stream);
if (!writable) callback.call(stream);
};
const onclose = () => {