--delay
helped me to fix both of issues
-
on auto-restart
-
stopping with
ctrl-c
nodemon --delay 500ms app.js
And I also added:
process.once('SIGUSR2', function () {
process.kill(process.pid, 'SIGUSR2');
});
process.on('SIGINT', function () {
// this is only called on ctrl+c, not restart
process.kill(process.pid, 'SIGINT');
});