signal-exit
when you want to fire an event no matter how a process exits.
Last updated 2 months 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 (2 months ago)
  • 3.0.1                                ...           next (4 years ago)

15 Versions

  • 3.0.3                                ...           2 months 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,271
This Week 2,271
This Month 835,364
Last Day 17,740
Last Week 268,356
Last Month 1,287,241
Dependencies (0)
None
Dev Dependencies (6)
Dependents (276)

Copyright 2014 - 2016 © taobao.org |