esc-exit

2.0.0 • Public • Published

esc-exit Build Status

Exit the process when the esc key is pressed

Useful for CLI tools to let the user press esc to get out.

Install

$ npm install esc-exit

Usage

const escExit = require('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.

License

MIT © Sindre Sorhus

install

npm i esc-exit

Downloadsweekly downloads

133

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability