remy/nodemon — pull request #396 by skyl (2014-09-30 05:58:08+00:00)
Title: exit REPL without exiting process

I want to embed a REPL and be able to exit the REPL without exiting the process.

Take this code as example:

```
express = require "express"
repl = require "repl"

app = express()

start = (context) ->
r = repl.start("> ")
for k,v of context
r.context[k] = v

app.get '/', (req, res) ->
start
req: req
res: res
res.send "OK"

server = app.listen 3000, () ->
console.log 'Listening on port %d', server.address().port
```

Without this small change, ctrl+d in the embedded REPL will exit the process completely, without even firing the REPL's exit event. With this PR, ctrl+d will exit the REPL but leave the process alive, whereas two `ctrl+c`s will exit the process as usual.