-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 bug to properly close readline. #52
Conversation
@SBoudrias I see that there is a test that inquirer should always create a new instance of readline, what is the reason behind this? If there is a reason why this behaviour is necessary then I'll have to work on getting it to work with close() but I can't see any reason why it is not working with close() with the current code (I tried removing the resume call but that doesn't fix it) so I suspect it is a bug in node somewhere. |
The The relevant commit: 1a7bc41 None the less, I'll test your current patch and see if the same issue happen again. |
If we do need to use There is definitely a node bug and I've managed to reduce it down to a smallish testcase and opened a ticket: nodejs/node-v0.x-archive#5927 |
If this works, let fix it this way. |
Ok, I'll update the pull request when I've finished my dinner. |
@SBoudrias I've updated the pull request. |
Fix bug to properly close readline.
Thank you! |
@SBoudrias I have found the bug causing #49, turns out all the blocking code is already in place and working fine and it was this pesky code bug:
(Only showing problem code)
As you can see resume() is called on readline even though there is no pause implemented. In fact as it stands it is not possible for readline to be present since it always get's destroyed in onCompletion.
To fix this we should call
this.rl.pause();
and remove the line that destroys the readline Interface.