diff --git a/doc/api/repl.markdown b/doc/api/repl.markdown index a5fd1acacb9..60a5b72ab77 100644 --- a/doc/api/repl.markdown +++ b/doc/api/repl.markdown @@ -29,8 +29,8 @@ For example, you could add this to your bashrc file: ## repl.start([prompt], [stream], [eval], [useGlobal], [ignoreUndefined]) -Starts a REPL with `prompt` as the prompt and `stream` for all I/O. `prompt` -is optional and defaults to `> `. `stream` is optional and defaults to +Returns and starts a REPL with `prompt` as the prompt and `stream` for all I/O. +`prompt` is optional and defaults to `> `. `stream` is optional and defaults to `process.stdin`. `eval` is optional too and defaults to async wrapper for `eval()`. @@ -76,6 +76,20 @@ TCP sockets. By starting a REPL from a Unix socket-based server instead of stdin, you can connect to a long-running node process without restarting it. +### Event: 'exit' + +`function () {}` + +Emitted when the user exits the REPL in any of the defined ways. Namely, typing +`.exit` at the repl, or pressing Ctrl+C twice to signal SIGINT. + +Example of listening for `exit`: + + r.on('exit', function () { + console.log('Got "exit" event from repl!'); + process.exit(); + }); + ## REPL Features