Comparing version 1.1.0 to 1.1.1
17
index.js
'use strict'; | ||
var cbs = []; | ||
var called = false; | ||
function exit(sig) { | ||
function exit(exit, signal) { | ||
if (called) { | ||
return; | ||
} | ||
called = true; | ||
cbs.forEach(function (el) { | ||
@@ -10,4 +17,4 @@ el(); | ||
if (sig) { | ||
process.exit(128); | ||
if (exit === true) { | ||
process.exit(128 + signal); | ||
} | ||
@@ -21,5 +28,5 @@ }; | ||
process.once('exit', exit); | ||
process.once('SIGINT', exit.bind(null, true)); | ||
process.once('SIGTERM', exit.bind(null, true)); | ||
process.once('SIGINT', exit.bind(null, true, 2)); | ||
process.once('SIGTERM', exit.bind(null, true, 15)); | ||
} | ||
}; |
{ | ||
"name": "exit-hook", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Run some code when the process exits", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1782
23