joyent/node — pull request #2919 by TooTallNate (2012-03-13 02:17:09+00:00)
Title: Turn REPLServer into an EventEmitter and emit "exit"

The first commit (ac77cc08) fixes a very minor Windows bug.

Second turns REPLServer into an EventEmitter

Third makes REPLServer emit 'exit' events instead of 1) manually killing the processes (_very bad!_) or 2) simply pausing the stream (derefs stdout, but simply pauses a net.Socket).

The next 3 could probably be squashed. They alter the behavior or when "SIGINT" is received on the readline socket. I think this new behavior is more expected. ae49ad43 shows the before and after.

This pull alone isn't enough to make a full featured repl work over a `net.Socket`, but it's an unobtrusive start, and makes this hacky gist work for the time being: https://gist.github.com/2026110