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:
parent
dd74b163f9
commit
ce62e963a1
@ -59,9 +59,9 @@ function eos(stream, opts, callback) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let readable = opts.readable ||
|
const readable = opts.readable ||
|
||||||
(opts.readable !== false && isReadable(stream));
|
(opts.readable !== false && isReadable(stream));
|
||||||
let writable = opts.writable ||
|
const writable = opts.writable ||
|
||||||
(opts.writable !== false && isWritable(stream));
|
(opts.writable !== false && isWritable(stream));
|
||||||
|
|
||||||
const onlegacyfinish = () => {
|
const onlegacyfinish = () => {
|
||||||
@ -69,15 +69,13 @@ function eos(stream, opts, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onfinish = () => {
|
const onfinish = () => {
|
||||||
writable = false;
|
|
||||||
writableFinished = true;
|
writableFinished = true;
|
||||||
if (!readable) callback.call(stream);
|
if (!readable || readableEnded) callback.call(stream);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onend = () => {
|
const onend = () => {
|
||||||
readable = false;
|
|
||||||
readableEnded = true;
|
readableEnded = true;
|
||||||
if (!writable) callback.call(stream);
|
if (!writable || writableFinished) callback.call(stream);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onclose = () => {
|
const onclose = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user