Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: fix handling generators in Readable.from #32844

Closed
2 changes: 1 addition & 1 deletion lib/internal/streams/from.js
Expand Up @@ -55,7 +55,7 @@ function from(Readable, iterable, opts) {
} catch (e) {
error = error || e;
} finally {
cb(error);
process.nextTick(() => cb(error));
ronag marked this conversation as resolved.
Show resolved Hide resolved
}
};
vadzim marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-readable-from-iterator-closing.js
Expand Up @@ -166,7 +166,7 @@ async function closeStreamWhileNextIsPending() {

async function closeAfterNullYielded() {
const finallyMustCall = mustCall();
const bodyMustCall = mustCall(3);
const dataMustCall = mustCall(3);

function* infiniteGenerate() {
try {
Expand All @@ -182,7 +182,7 @@ async function closeAfterNullYielded() {
const stream = Readable.from(infiniteGenerate());

stream.on('data', (chunk) => {
bodyMustCall();
dataMustCall();
strictEqual(chunk, 'a');
});
}
Expand Down