node/tools/eslint/node_modules/exit-hook/readme.md
Michaël Zasso 2d441493a4 tools: update eslint to v1.10.3
PR-URL: https://github.com/nodejs/io.js/pull/2286
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-13 23:15:39 +01:00

41 lines
676 B
Markdown

# exit-hook [![Build Status](https://travis-ci.org/sindresorhus/exit-hook.svg?branch=master)](https://travis-ci.org/sindresorhus/exit-hook)
> Run some code when the process exits
The `process.on('exit')` event doesn't catch all the ways a process can exit.
Useful for cleaning up.
## Install
```sh
$ npm install --save exit-hook
```
## Usage
```js
var exitHook = require('exit-hook');
exitHook(function () {
console.log('exiting');
});
// you can add multiple hooks, even across files
exitHook(function () {
console.log('exiting 2');
});
throw new Error('unicorns');
//=> exiting
//=> exiting 2
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)