SIGINT event (Readline)

Event: 'SIGINT'

function () {}

Emitted whenever the input stream receives a ^C, respectively known as SIGINT. If there is no SIGINT event listener present when the input stream receives a SIGINT, pause will be triggered.

Example of listening for SIGINT:

rl.on('SIGINT', () => {
  rl.question('Are you sure you want to exit?', (answer) => {
    if (answer.match(/^y(es)?$/i)) rl.pause();
  });
});
doc_Nodejs
2016-04-30 04:42:19
Comments
Leave a Comment

Please login to continue.