https://github.com/leelow/hook-exit
đĒ đ An easy way to hook process.exit().
https://github.com/leelow/hook-exit
exit handler hook javascript js mock nodejs quit stop
Last synced: about 1 month ago
JSON representation
đĒ đ An easy way to hook process.exit().
- Host: GitHub
- URL: https://github.com/leelow/hook-exit
- Owner: Leelow
- License: mit
- Created: 2017-03-31T15:13:50.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-25T19:40:27.000Z (over 7 years ago)
- Last Synced: 2025-02-15T13:18:21.471Z (over 1 year ago)
- Topics: exit, handler, hook, javascript, js, mock, nodejs, quit, stop
- Language: JavaScript
- Size: 193 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# hook-exit
[](https://greenkeeper.io/)
[![npm version][npm-version-image]][npm-version-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url]
[![Build Status][appveyor-image]][appveyor-url]
[![Codacy Coverage][codacy-coverage-image]][codacy-coverage-url]
[![Codacy Grade][codacy-grade-image]][codacy-grade-url]
[![Dependencies][dependencies-image]][dependencies-url]
[![Dev-dependencies][dev-dependencies-image]][dev-dependencies-url]
[![JavaScript Style Guide][javascript-standard-image]][javascript-standard-url]
An easy way to hook process.exit().
## Install
```
$ npm install --save hook-exit
```
## Usage
```js
const exit = require('hook-exit');
exit.hook(function() { // exit is disable
console.log('I do not want to exit !');
})
process.exit();
exit.unhook(); // exit is enable
process.exit();
```
## Test and coverage
You just have to clone the repo and run
```
$ npm test
$ npm run coverage
```
## License
[MIT](LICENSE) Š [LÊo Lozach](https://github.com/Leelow)
[npm-version-image]: https://badge.fury.io/js/hook-exit.svg
[npm-version-url]: https://www.npmjs.com/package/hook-exit
[downloads-image]: https://img.shields.io/npm/dt/hook-exit.svg?maxAge=3600
[downloads-url]: https://www.npmjs.com/package/hook-exit
[travis-image]: https://travis-ci.org/Leelow/hook-exit.svg?branch=master
[travis-url]: https://travis-ci.org/Leelow/hook-exit
[appveyor-image]: https://ci.appveyor.com/api/projects/status/32aj3ap0kelnbdqt?svg=true
[appveyor-url]: https://ci.appveyor.com/project/Leelow/hook-exit
[codacy-coverage-image]: https://api.codacy.com/project/badge/Coverage/be1d56eb162d41a586ecac79685161f7
[codacy-coverage-url]: https://www.codacy.com/app/Leelow/hook-exit?utm_source=github.com&utm_medium=referral&utm_content=Leelow/hook-exit&utm_campaign=Badge_Coverage
[codacy-grade-image]: https://api.codacy.com/project/badge/Grade/be1d56eb162d41a586ecac79685161f7
[codacy-grade-url]: https://www.codacy.com/app/Leelow/hook-exit?utm_source=github.com&utm_medium=referral&utm_content=Leelow/hook-exit&utm_campaign=Badge_Grade
[dependencies-image]: https://david-dm.org/leelow/hook-exit/status.svg
[dependencies-url]: https://david-dm.org/leelow/hook-exit?type=dev
[dev-dependencies-image]: https://david-dm.org/leelow/hook-exit/dev-status.svg
[dev-dependencies-url]: https://david-dm.org/leelow/hook-exit?type=dev
[javascript-standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[javascript-standard-url]: http://standardjs.com/