aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/stream.js
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-07-10 18:25:20 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-10 18:25:20 -0700
commitb2c576bba2c3274eac32cd0a70318339c3683425 (patch)
tree8c5c41b25a424cf1f05b248a25a37fda0ce7eaf8 /src/js/node/stream.js
parent4af4b508a1027ee837f69d4fed5a246629714398 (diff)
downloadbun-b2c576bba2c3274eac32cd0a70318339c3683425.tar.gz
bun-b2c576bba2c3274eac32cd0a70318339c3683425.tar.zst
bun-b2c576bba2c3274eac32cd0a70318339c3683425.zip
fix "readable" event being emitted incorrectly (#3475)
* fix "readable" event being emitted incorrectly * fix impl and add test * changes * asdfghj * esm
Diffstat (limited to 'src/js/node/stream.js')
-rw-r--r--src/js/node/stream.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/js/node/stream.js b/src/js/node/stream.js
index 741b2f65c..30c76d797 100644
--- a/src/js/node/stream.js
+++ b/src/js/node/stream.js
@@ -5356,10 +5356,10 @@ function createNativeStreamReadable(nativeType, Readable) {
return chunk;
}
- push(result, encoding) {
- __DEBUG__ && debug("NativeReadable push -- result, encoding", result, encoding, this.__id);
- return super.push(...arguments);
- }
+ // push(result, encoding) {
+ // __DEBUG__ && debug("NativeReadable push -- result, encoding", result, encoding, this.__id);
+ // return super.push(...arguments);
+ // }
#handleResult(result, view, isClosed) {
__DEBUG__ && debug("result, isClosed @ #handleResult", result, isClosed, this.__id);
@@ -5372,7 +5372,9 @@ function createNativeStreamReadable(nativeType, Readable) {
return handleNumberResult(this, result, view, isClosed);
} else if (typeof result === "boolean") {
- this.push(null);
+ process.nextTick(() => {
+ this.push(null);
+ });
return view?.byteLength ?? 0 > 0 ? view : undefined;
} else if (ArrayBuffer.isView(result)) {
if (result.byteLength >= this.#highWaterMark && !this.#hasResized && !isClosed) {