summaryrefslogtreecommitdiff
path: root/lib/_stream_readable.js
diff options
context:
space:
mode:
authorMatteo Collina <hello@matteocollina.com>2018-02-07 10:52:04 +0100
committerMatteo Collina <hello@matteocollina.com>2018-02-08 11:58:04 +0100
commit87b9bceacb6877e62148ea0f96f89a03f9b76a47 (patch)
tree385a0acf7b3cbe1215aa3385b71957329bd1bb9f /lib/_stream_readable.js
parentd8f73385e220d54de9f9c53da8d8693813e6d774 (diff)
downloadnode-new-87b9bceacb6877e62148ea0f96f89a03f9b76a47.tar.gz
stream: always defer readable in EOF when sync
Fix a regression introduced by https://github.com/nodejs/node/pull/18515 that broke the dicer module tests. See: https://github.com/nodejs/node/pull/18515 PR-URL: https://github.com/nodejs/node/pull/18615 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'lib/_stream_readable.js')
-rw-r--r--lib/_stream_readable.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index c7b356ed44..46afe5f33d 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -488,9 +488,9 @@ function onEofChunk(stream, state) {
}
state.ended = true;
- if (state.sync && state.length) {
- // if we are sync and have data in the buffer, wait until next tick
- // to emit the data. otherwise we risk emitting data in the flow()
+ if (state.sync) {
+ // if we are sync, wait until next tick to emit the data.
+ // Otherwise we risk emitting data in the flow()
// the readable code triggers during a read() call
emitReadable(stream);
} else {