I\'m following the guidance here (listening for SIGINT events) to gracefully shutdown my Windows-8-hosted node.js application in response to Ctrl+
Currently there is still no support in node for capturing the windows console control events, so there are no equivalents to the POSIX signals:
https://github.com/joyent/node/issues/1553
However the tty module documentation does give an example of a mechanism to capture the key presses in order to initiate a graceful shutdown, but then this does only work for ctrl+c.
var tty = require('tty');
process.stdin.resume();
tty.setRawMode(true);
process.stdin.on('keypress', function(char, key) {
if (key && key.ctrl && key.name == 'c') {
console.log('graceful exit of process %d', process.pid);
process.exit();
}
});