This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before editing readline.js, I was having problems with closing a readline interface. The interface would "close", but would still trigger the
rl.on('line', ...)
event, and also echoing the command that was being input.I notice that
rl.close()
only emulates closing. It doesn't actually destroy the input withinput.destroy()
. I left it emulating closing for the proposal.The proposal: since
rl.close()
is only emulating closing, and doesn't actually destroy the input, the input still keeps the program open. I added code intorl.resume()
to resume the readline without having to runrl.createInterface()
again.However, the problem with doing this is (as I pointed out) the readline makes the program hang from not destroying the input. So, I would also propose that the input be destroyed, but
rl.resume()
runrl.createInterface()
with the input, output, and completer that was already provided.Already spoke about this with @isaacs and @bnoordhuis, but wanted to see what everyone else has to say/add.