'close' 事件

当发生以下任一情况时会触发 'close' 事件:

  • 调用 rl.close() 方法,且 readline.Interface 实例放弃对 input 流和 output 流的控制;
  • input 流接收到其 'end' 事件;
  • input 流接收到 Ctrl+D 以发信号传输结束(EOT);
  • input 流接收到 Ctrl+C 以发信号 SIGINT,并且 readline.Interface 实例上没有注册 'SIGINT' 事件监听器。


一旦触发 'close' 事件,则 readline.Interface 实例就完成了。

The 'close' event is emitted when one of the following occur:

  • The rl.close() method is called and the readline.Interface instance has relinquished control over the input and output streams;
  • The input stream receives its 'end' event;
  • The input stream receives Ctrl+D to signal end-of-transmission (EOT);
  • The input stream receives Ctrl+C to signal SIGINT and there is no 'SIGINT' event listener registered on the readline.Interface instance.

The listener function is called without passing any arguments.

The readline.Interface instance is finished once the 'close' event is emitted.