Skip to content

Commit

Permalink
Revert "stream: remove ambiguous code"
Browse files Browse the repository at this point in the history
This reverts commit ce62e96.

PR-URL: #29717
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
  • Loading branch information
mcollina committed Oct 10, 2019
1 parent 7682874 commit 8c60685
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/internal/streams/end-of-stream.js
Expand Up @@ -59,23 +59,25 @@ 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 = () => {
if (!stream.writable) onfinish();
};

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 = () => {
Expand Down

0 comments on commit 8c60685

Please sign in to comment.