事件:'exit'


¥Event: 'exit'

当通过接收 .exit 命令作为输入、用户按 Ctrl+C 两次以触发 SIGINT 信号或通过按 Ctrl+D 以在输入流上触发 'end' 信号退出 REPL 时,会触发 'exit' 事件。不带任何参数调用监听器回调。

¥The 'exit' event is emitted when the REPL is exited either by receiving the .exit command as input, the user pressing Ctrl+C twice to signal SIGINT, or by pressing Ctrl+D to signal 'end' on the input stream. The listener callback is invoked without any arguments.

replServer.on('exit', () => {
  console.log('Received "exit" event from repl!');
  process.exit();
});