Run some code when the process exits.
async-exit-hook is a fork from
exit-hook which can catch:
- process SIGINT, SIGTERM and SIGHUP, SIGBREAK signals
- process beforeExit and exit events
- PM2's exit.
process.on('exit') event doesn't catch all the ways a process can exit.
npm install async-exit-hook
1 2 3 4 5 6 7 8 9 10