dshaw/repl-client — pull request #3 by kitcambridge (2013-04-16 07:54:36+00:00)
Title: Call `setRawMode` before destroying the socket.

`process.stdin` has a default `end` event handler that automatically calls `.end()` at the end of the current tick. This prematurely removes the handle associated with the `stdin` stream, which causes `setRawMode` to throw a `TypeError` when the socket's `close` event is triggered on the next tick.

**To reproduce the issue**: Use `rc` under Node v0.10 to connect to a socket, then attempt to end the transmission by pressing `Ctrl + D`. The command will exit with a `TypeError`: `Cannot call method 'setRawMode' of null`.