-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
readable[Symbol.asyncIterator]().next() on stream causes immediate exit (no error) #34219
Comments
I believe this is a duplicate of #33463 |
@kwkelly that's just because your code is waiting for a promise that will never be resolved. if you want, try replacing that line with |
Ok, I think I understand now. So |
@kwkelly but since it wraps an event emitter it is technically never done, it's waiting for the next 'line' event that will never come. @nodejs/readline maybe we should remove readline's current async iterator and add a stream version of readline instead. |
A stream can also be consumed as an async iterator 😄 |
@ronag yeah that's the idea. streams will exhibit backpressure so this dropping events thing won't be a problem. |
The overall problem here is that Some other discussion of this issue here: https://stackoverflow.com/questions/62885667/why-does-this-readline-async-iterator-not-work-properly#comment111206701_62885667 |
we should just expose a stream version of it. |
@devsnek - Yes, readline is a mess for this type of use (numerous bugs). A nice clean stream version would be great. |
What steps will reproduce the bug?
When
next()
is called in the program below, nothing else gets run. list.txt and list2.txt are just two line filesline1\nline2
andline3\nline4
This repl.it shows the issue.
https://repl.it/repls/FrightenedPastLogin#index.js
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
The rest of the program should execute. The following should print
What do you see instead?
Nothing:
Possibly related to #33792 #34035?
The text was updated successfully, but these errors were encountered: