@cjser/esc-exit
v3.0.1-cjser.2
Published
Exit the process when the `esc` key is pressed
Maintainers
Readme
esc-exit
Exit the process when the esc key is pressed
Useful for CLI tools to let the user press esc or control+c to get out.
Install
npm install esc-exitUsage
import escExit from 'esc-exit';
escExit();API
Using this prevents the process from exiting normally.
There are multiple ways you can handle this:
Call the unsubscribe method that
escExit()returns when you're done listening. It will then let the process exit normally.Call
process.exit()to exit the process directly.
cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/esc-exit
