'exit' 事件


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

replServer.on('exit', () => {
  console.log('Received "exit" event from repl!');
  process.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();
});