Skip to content

peol/sigint-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sigint-hook

Normalize the process SIGINT signal.

Usage

Install

npm install sigint-hook

Configuration

eventOnHookOnly (default false): if true, will not emit on the process global object

triggerOnce (default: false): if true, will stop listening after first SIGINT signal

Examples

Default:

require("sigint-hook")().on("SIGINT", function() {
  // do something
});

Customized:

require("sigint-hook")({
	eventOnHookOnly: true,
	triggerOnce: true
}).on("SIGINT", function() {
  // do something
});

Please note that you can kill sigint-hook by running the .close() method on the return object:

var sigint = require("sigint-hook")({
	eventOnHookOnly: true
}).on("SIGINT", function() {
  // do something
});

// kill off early:
sigint.close();

License

This project uses MIT. See LICENSE file for additional information.

About

Take control of the SIGINT signal.

Resources

License

Stars

Watchers

Forks

Packages

No packages published