0

Is this at all correct?

var sigintCount = 0;

process.on('SIGINT', () => {
    console.log('Got your SIGINT => Press Control-C *twice* to exit.');
    sigintCount++;
    if(sigintCount > 1){
        process.exit();   //what is an appropriate exit code?
    }
});

and what exit code should I use?

Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
  • 2
    Up to you...0 if it exited normally (the default), 1 if it errored out, 2+ if you want to specify something special. – Aaron_H May 15 '16 at 04:40
  • `nodejs process` does not emit any event named `SIGINT`. However if it were, your code should work. Although you might want to put a `connected` check before exit so it doesn't throw any excepions. – Vikash Kesarwani May 15 '16 at 04:44
  • There must be an accepted exit code for processes killed by a SIGINT? – Alexander Mills May 15 '16 at 04:52
  • Check this so http://unix.stackexchange.com/a/99117 –  May 15 '16 at 05:22

0 Answers0