node-dev
node-dev copied to clipboard
Node-dev does not send SIGTERM on CTRL+C
My package.json
script uses the node-dev CLI to run code with the event listener:
process.on('SIGTERM', () => {
console.log('SIGTERM fired...');
});
When I use CTRL+C
to halt the server, I get no console notifications.
This should be handled so we can properly exit node-dev servers with CTRL+C
. Thank you!
From https://nodejs.org/api/process.html#signal-events
'SIGTERM' and 'SIGINT' have default handlers on non-Windows platforms that reset the terminal mode before exiting with code 128 + signal number. If one of these signals has a listener installed, its default behavior will be removed (Node.js will no longer exit).
If you add a SIGTERM
handler, you are expected to shutdown the process yourself either by calling process.exit or removing all listeners.