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 async iteration doesn't work with already closed streams #23891

Closed
TimothyGu opened this issue Oct 26, 2018 · 1 comment
Closed

Stream async iteration doesn't work with already closed streams #23891

TimothyGu opened this issue Oct 26, 2018 · 1 comment
Labels
stream Issues and PRs related to the stream subsystem.

Comments

@TimothyGu
Copy link
Member

'use strict';

const { Readable } = require('stream');

const r = new Readable({
  objectMode: true,
  read() {
    this.push('asdf');
    this.push('hehe');
    this.push(null);
  }
});

(async () => {
  for await (const a of r) {
    console.log(a);
  }
  for await (const b of r) {
    console.log(b);
  }
  console.log('done');
})();

This prints

asdf
hehe

notably without the "done" line.

@TimothyGu TimothyGu added the stream Issues and PRs related to the stream subsystem. label Oct 26, 2018
@TimothyGu
Copy link
Member Author

/cc @mcollina @devsnek

mcollina added a commit to mcollina/node that referenced this issue Oct 26, 2018
@targos targos closed this as completed in 398418d Oct 28, 2018
targos pushed a commit that referenced this issue Oct 28, 2018
Fixes: #23891

PR-URL: #23901
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this issue Nov 1, 2018
Fixes: #23891

PR-URL: #23901
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this issue Nov 26, 2018
Fixes: #23891

PR-URL: #23901
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
rvagg pushed a commit that referenced this issue Nov 28, 2018
Fixes: #23891

PR-URL: #23901
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this issue Nov 29, 2018
Fixes: #23891

PR-URL: #23901
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

1 participant