Skip to content

Commit 6e73212

Browse files
committed
fixup
1 parent 1f4e70e commit 6e73212

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/internal/streams/duplexify.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,17 @@ module.exports = function duplexify(body, name) {
206206
function fromAsyncGen(fn) {
207207
let { promise, resolve } = createDeferredPromise();
208208
const ac = new AbortController();
209+
const signal = ac.signal;
209210
const value = fn(async function*() {
210211
while (true) {
211212
const { chunk, done, cb } = await promise;
212213
process.nextTick(cb);
213214
if (done) return;
215+
if (signal.aborted) throw new AbortError();
214216
yield chunk;
215217
({ promise, resolve } = createDeferredPromise());
216218
}
217-
}(), { signal: ac.signal });
219+
}(), { signal });
218220

219221
return {
220222
value,

0 commit comments

Comments
 (0)