# ctrlc-exit
**Repository Path**: mirrors_vadimdemedes/ctrlc-exit
## Basic Information
- **Project Name**: ctrlc-exit
- **Description**: Exit the process when `Ctrl`+`C` is pressed
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-26
- **Last Updated**: 2025-09-20
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# ctrlc-exit [](https://travis-ci.org/vadimdemedes/ctrlc-exit)
> Exit the process when Ctrl+C is pressed
Useful for CLI tools when default behavior to exit is disabled (e.g. raw mode is enabled).
## Install
```
$ npm install ctrlc-exit
```
## Usage
```js
const ctrlcExit = require('ctrlc-exit');
ctrlcExit();
```
## API
Using this prevents the process from exiting normally.
There are multiple ways you can handle this:
- Call `ctrlcExit.done()` when you're done listening. It will then let the process exit normally.
- Use `process.stdin.unref()` if you don't intend to use `process.stdin` afterwards. It will let the process exit normally.
- Call `process.exit()` to exit the process directly.
## Related
- [esc-exit](https://github.com/sindresorhus/esc-exit) - Exit the process using Esc.
## License
MIT © [Vadim Demedes](https://github.com/vadimdemedes)