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>
This commit is contained in:
parent
d8f73385e2
commit
87b9bceacb
@ -488,9 +488,9 @@ function onEofChunk(stream, state) {
|
|||||||
}
|
}
|
||||||
state.ended = true;
|
state.ended = true;
|
||||||
|
|
||||||
if (state.sync && state.length) {
|
if (state.sync) {
|
||||||
// if we are sync and have data in the buffer, wait until next tick
|
// if we are sync, wait until next tick to emit the data.
|
||||||
// to emit the data. otherwise we risk emitting data in the flow()
|
// Otherwise we risk emitting data in the flow()
|
||||||
// the readable code triggers during a read() call
|
// the readable code triggers during a read() call
|
||||||
emitReadable(stream);
|
emitReadable(stream);
|
||||||
} else {
|
} else {
|
||||||
|
@ -160,7 +160,7 @@ const BATCH = 10;
|
|||||||
});
|
});
|
||||||
|
|
||||||
readable.on('end', common.mustCall(() => {
|
readable.on('end', common.mustCall(() => {
|
||||||
assert.strictEqual(nextTickPassed, false);
|
assert.strictEqual(nextTickPassed, true);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user