Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

exit-code

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exit-code - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

19

index.js

@@ -10,3 +10,4 @@ if (process.version.match(/^v(0\.12\.|[^0])/))

code = c
setup()
if (exiting && code)
process.exit(code)
},

@@ -19,11 +20,7 @@ get: function () {

var didSetup = false
function setup () {
if (didSetup)
return
didSetup = true
process.on('exit', function (c) {
if (code && !c)
process.exit(code)
})
}
var exiting = false
process.on('exit', function (c) {
exiting = true
if (code && !c)
process.exit(code)
})
{
"name": "exit-code",
"version": "1.0.1",
"version": "1.0.2",
"description": "`process.exitCode` behavior back-ported from io.js and Node.js 0.12+",

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

@@ -10,2 +10,12 @@ if (!isNaN(process.argv[2])) {

if (!isNaN(process.argv[3])) {
require('./')
setTimeout(function () {
process.on('exit', function () {
process.exitCode = +process.argv[3]
})
})
return
}
var test = require('tap').test

@@ -16,9 +26,18 @@ var spawn = require('child_process').spawn

test('exitCodes', function (t) {
test('immediate exit', function (t) {
t.plan(codes.length)
codes.forEach(function (want) {
spawn(node, [__filename, want]).on('close', function (found) {
t.equal(found, want)
t.equal(found, want, 'immediate exit ' + want)
})
})
})
test('deferred exit', function (t) {
t.plan(codes.length)
codes.forEach(function (want) {
spawn(node, [__filename, 'x', want]).on('close', function (found) {
t.equal(found, want, 'deferred exit ' + want)
})
})
})
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc