summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/streams/end-of-stream.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/internal/streams/end-of-stream.js b/lib/internal/streams/end-of-stream.js
index 585a52ae2f..949ab63814 100644
--- a/lib/internal/streams/end-of-stream.js
+++ b/lib/internal/streams/end-of-stream.js
@@ -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 = () => {