signal-exit
when you want to fire an event no matter how a process exits.
Last updated 5 days ago by bcoe .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install signal-exit 
SYNC missed versions from official npm registry.

signal-exit

Build Status Coverage NPM version Standard Version

When you want to fire 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

Use signal-exit.

var onExit = require('signal-exit')

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

API

var remove = onExit(function (code, signal) {}, options)

The return value of the function is a function that will remove the handler.

Note that the function only fires for signals if the signal would cause the proces to exit. That is, there are no other listeners, and it is a fatal signal.

Options

  • alwaysLast: Run this handler after any other signal or exit handlers. This causes process.emit to be monkeypatched.

Current Tags

  • 3.0.3                                ...           latest (5 days ago)
  • 3.0.1                                ...           next (4 years ago)

15 Versions

  • 3.0.3                                ...           5 days ago
  • 3.0.2                                ...           3 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 3.0.0-candidate                                ...           4 years ago
  • 2.1.2                                ...           5 years ago
  • 2.1.1                                ...           5 years ago
  • 2.1.0                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.3.1                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 2,161
This Week 125,855
This Month 2,161
Last Day 59,195
Last Week 260,414
Last Month 938,277
Dependencies (0)
None
Dev Dependencies (6)
Dependents (262)

Copyright 2014 - 2016 © taobao.org |