|
@ -29,8 +29,8 @@ For example, you could add this to your bashrc file: |
|
|
|
|
|
|
|
|
## repl.start([prompt], [stream], [eval], [useGlobal], [ignoreUndefined]) |
|
|
## repl.start([prompt], [stream], [eval], [useGlobal], [ignoreUndefined]) |
|
|
|
|
|
|
|
|
Starts a REPL with `prompt` as the prompt and `stream` for all I/O. `prompt` |
|
|
Returns and starts a REPL with `prompt` as the prompt and `stream` for all I/O. |
|
|
is optional and defaults to `> `. `stream` is optional and defaults to |
|
|
`prompt` is optional and defaults to `> `. `stream` is optional and defaults to |
|
|
`process.stdin`. `eval` is optional too and defaults to async wrapper for |
|
|
`process.stdin`. `eval` is optional too and defaults to async wrapper for |
|
|
`eval()`. |
|
|
`eval()`. |
|
|
|
|
|
|
|
@ -76,6 +76,20 @@ TCP sockets. |
|
|
By starting a REPL from a Unix socket-based server instead of stdin, you can |
|
|
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. |
|
|
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 |
|
|
## REPL Features |
|
|
|
|
|
|
|
|