Node and NPM Running script and Ctrl-C triggers SIGINT twice
问题 I've come across a problem on one of my Nodejs apps running with npm start (which just does node app.js ). My app contains a sigint handler as follows: process.on('SIGINT', () => { db.disconnect().then({ process.exit(0); }).catch(e => process.exit(1)); }); With corresponding logs. After some testing on other files, I've noticed that Ctrl-C when on an npm process triggers SIGINT twice if the first one takes too long to exit. (try adding a timeout on a sample app). For now I've added a counter