From 74069add3f400ad6b232ad18840206ab96b9fe80 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Mon, 16 Sep 2024 14:23:40 +0200 Subject: fix(runtime): don't error `child.output()` on consumed stream (#25657) This fixes the fast path for `readableStreamCollectIntoUint8Array` to only trigger if the readable stream has not yet been disturbed - because otherwise we may not be able to close it if the read errors. --- ext/web/06_streams.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index 1dbf769b2..a4f2275c5 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -1054,7 +1054,7 @@ async function readableStreamCollectIntoUint8Array(stream) { getReadableStreamResourceBackingUnrefable(stream); const reader = acquireReadableStreamDefaultReader(stream); - if (resourceBacking) { + if (resourceBacking && !isReadableStreamDisturbed(stream)) { // fast path, read whole body in a single op call try { readableStreamDisturb(stream); -- cgit v1.2.3