Signal-exit

signal-exit

Fire an event no matter how a process exits.

signal-exit fires an event no matter how a process exits:

  • reaching the end of execution.
  • explicitly having process.exit(code) called.
  • having process.kill(pid, sig) called.
  • receiving a fatal signal from outside the process

Get it: npm install signal-exit

Sample code:

1
2
3
4
5
var onExit = require('signal-exit')

onExit(function (code, signal) {
  console.log('process exited!', code, signal)
})

GIF FTW!

signal-exit

Suggest a module

Comments