From 39eaf14526fd8f09bf8d944f800e4ed3629b92ab Mon Sep 17 00:00:00 2001 From: Bill Min Date: Tue, 21 May 2024 17:52:31 -0400 Subject: [PATCH] fix: ignore error if stream is ended --- src/util/stream.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/util/stream.ts b/src/util/stream.ts index e692f3d..995acec 100644 --- a/src/util/stream.ts +++ b/src/util/stream.ts @@ -113,7 +113,6 @@ export function createWritable(): StreamWritable { }, error(reason: unknown) { error = reason; - done = true; buf = ""; if (pending) { @@ -122,10 +121,6 @@ export function createWritable(): StreamWritable { } }, async next() { - if (error) { - throw error; - } - if (buf) { const value = buf; buf = ""; @@ -142,6 +137,10 @@ export function createWritable(): StreamWritable { }; } + if (error) { + throw error; + } + await (pending = createDeferred()); return this.next(); },