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

14 Versions

  • 3.0.2                                ...           3 years ago
  • 3.0.1                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 3.0.0-candidate                                ...           3 years ago
  • 2.1.2                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (2)
Downloads
Today 490
This Week 80,843
This Month 277,217
Last Day 27,943
Last Week 152,199
Last Month 582,331
Dependencies (0)
None
Dev Dependencies (6)
Dependents (235)

Copyright 2014 - 2017 © taobao.org |