Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

googlearchive/cleankill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cleankill

CleanKill hooks the interrupt handler, and provides callbacks for your code to cleanly shut down before the process exits.

As an escape hatch, if the user mashes interrupt, the process will be immediately killed.

Using It

var cleankill = require('cleankill');

To register a handler:

cleankill.onInterrupt(() => {
  return new Promise((resolve) => {
    // do things.
    resolve();
  });
});

If you wish to shut down any existing handlers (without exiting the process):

cleankill.close().then(() => {
  // All handlers have cleaned things up.
});