-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(node/readline): hang when closing on STDIN #15628
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
damn
I'm confused why a JS-only change could/would fix a segfault |
interesting 1 | })
2 | let readRequest = @getByIdDirectPrivate(@getByIdDirectPrivate(stream, "reader"), "readRequests").shift();
^
TypeError: undefined is not an object (evaluating '@getByIdDirectPrivate(@getByIdDirectPrivate(stream, "reader"), "readRequests").shift')
at handleResult (79:41)
at promiseReactionJob (45:84) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node's implementation doesn't call close on this.input
, and most of readline is copypasta. I think this likely introduces bugs (which is supported by the test failure)
What does this PR do?
Fixes #15344
Calling
close
on a readline interface (either sync or fromreadline/promises
) was not closing the underlying input. This was causing stdin to re-open, as unpause() was being called betweenemit("pause")
andemit("close")
I'm not quite sure what was causing the segfault, but this fixes that too.
How did you verify your code works?
I've added test cases.