Socket
Socket
Sign inDemoInstall

capture-exit

Package Overview
Dependencies
1
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

3

index.js

@@ -60,2 +60,5 @@ var RSVP = require('rsvp');

module.exports.onExit = function(cb) {
if (!exit) {
throw new Error('Cannot install handler when exit is not captured. Call `captureExit()` first');
}
var index = handlers.indexOf(cb);

@@ -62,0 +65,0 @@

2

package.json
{
"name": "capture-exit",
"version": "1.0.3",
"version": "1.0.4",
"description": "safely cleanup in signal handlers",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -9,2 +9,3 @@ var expect = require('chai').expect;

beforeEach(function() {
exit.releaseExit();
expect(process.exit, 'ensure we start in a correct state').to.equal(originalExit);

@@ -124,2 +125,3 @@ });

it('subscribes', function() {
exit.captureExit();
var didExit = 0;

@@ -140,2 +142,3 @@ function foo() {

it('does not subscribe duplicates', function() {
exit.captureExit();
var didExit = 0;

@@ -155,2 +158,8 @@ function foo() {

});
it('throws if exit is not captured', function() {
expect(function () {
exit.onExit(function () { });
}).to.throw('Cannot install handler when exit is not captured. Call `captureExit()` first');
});
});

@@ -160,2 +169,4 @@

it('unsubscribes', function() {
exit.captureExit();
var didExit = 0;

@@ -180,2 +191,4 @@ var didExitBar = 0;

it('does not unsubscribe duplicates', function() {
exit.captureExit();
var didExit = 0;

@@ -182,0 +195,0 @@ var didExitBar = 0;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc