capture-exit
safely cleanup in signal handlers
Last updated 2 years ago by rwjblue .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install capture-exit 
SYNC missed versions from official npm registry.

capture-exit

Build status Build Status

Allow cooprative async exit handlers, we unfortunately must hijack process.exit.

It allows a handler to ensure exit, without that exit handler impeding other similar handlers

for example, see: sindresorhus/ora#27

Differences between process.on('exit') and captureExit.onExit(...) => https://github.com/ember-cli/capture-exit/issues/12

Installation

yarn add capture-exit
// or
npm install --save capture-exit

Usage

// as early in startup as possible
require('capture-exit').captureExit();

// when you want to schedule some work on exit:
function onExit() {
  return something.processWillExit(); // you can return promises, which will pause exit until fulfilled
}

require('capture-exit').onExit(onExit); // add an exit handler
require('capture-exit').offExit(onExit); // allows one to remove an exit handle if it is not longer required

Current Tags

  • 2.0.0                                ...           latest (2 years ago)

11 Versions

  • 2.0.0                                ...           2 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.7                                ...           4 years ago
  • 1.0.6                                ...           4 years ago
  • 1.0.5                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Downloads
Today 900
This Week 14,153
This Month 57,133
Last Day 13,253
Last Week 66,866
Last Month 277,977
Dependencies (1)
Dev Dependencies (4)
Dependents (83)

Copyright 2014 - 2016 © taobao.org |