joyent/node — pull request #2737 by Southern (2012-02-11 02:43:07+00:00)
Title: Readline bugfix, and proposal.

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 with `input.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 into `rl.resume()` to resume the readline without having to run `rl.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()` run `rl.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.