stream: remove ambiguous code

PR-URL: https://github.com/nodejs/node/pull/29664
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Robert Nagy 2019-09-23 09:36:04 +02:00 committed by Minwoo Jung
parent dd74b163f9
commit ce62e963a1

View File

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