Exit the process when the esc key is pressed
Useful for CLI tools to let the user press esc to get out.
$ npm install --save esc-exit
var escExit = ;;
Using this prevents the process from exiting normally.
There are multiple ways you can handle this:
escExit.done() when you're done listening. It will then let the process exit normally.
process.stdin.unref() if you don't intend to use
procces.stdin afterwards. It will let the process exit normally.
process.exit() to exit the process directly.
MIT © Sindre Sorhus