We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f4e70e commit 6e73212Copy full SHA for 6e73212
lib/internal/streams/duplexify.js
@@ -206,15 +206,17 @@ module.exports = function duplexify(body, name) {
206
function fromAsyncGen(fn) {
207
let { promise, resolve } = createDeferredPromise();
208
const ac = new AbortController();
209
+ const signal = ac.signal;
210
const value = fn(async function*() {
211
while (true) {
212
const { chunk, done, cb } = await promise;
213
process.nextTick(cb);
214
if (done) return;
215
+ if (signal.aborted) throw new AbortError();
216
yield chunk;
217
({ promise, resolve } = createDeferredPromise());
218
}
- }(), { signal: ac.signal });
219
+ }(), { signal });
220
221
return {
222
value,
0 commit comments