1 | # signal-exit
|
2 |
|
3 | When you want to fire an event no matter how a process exits:
|
4 |
|
5 | * reaching the end of execution.
|
6 | * explicitly having `process.exit(code)` called.
|
7 | * having `process.kill(pid, sig)` called.
|
8 |
|
9 | Use `signal-exit`.
|
10 |
|
11 | ```js
|
12 | var onExit = require('signal-exit')
|
13 |
|
14 | onExit(function (code, signal) {
|
15 | console.log('process exited!')
|
16 | })
|
17 | ```
|