Commit 7266d64c authored by Paolo Greppi's avatar Paolo Greppi

New upstream version 3.0.2

parent b4a65be8
The ISC License
Copyright (c) 2015, Contributors
Permission to use, copy, modify, and/or distribute this software
......
......@@ -19,6 +19,15 @@ if (process.__signal_exit_emitter__) {
emitter.emitted = {}
}
// Because this emitter is a global, we have to check to see if a
// previous version of this library failed to enable infinite listeners.
// I know what you're about to say. But literally everything about
// signal-exit is a compromise with evil. Get used to it.
if (!emitter.infinite) {
emitter.setMaxListeners(Infinity)
emitter.infinite = true
}
module.exports = function (cb, opts) {
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')
......
{
"name": "signal-exit",
"version": "3.0.1",
"version": "3.0.2",
"description": "when you want to fire an event no matter how a process exits.",
"main": "index.js",
"scripts": {
......@@ -30,9 +30,9 @@
"devDependencies": {
"chai": "^3.5.0",
"coveralls": "^2.11.10",
"nyc": "^7.0.0",
"nyc": "^8.1.0",
"standard": "^7.1.2",
"standard-version": "^2.3.0",
"tap": "^6.2.0"
"tap": "^8.0.1"
}
}
var onexit = require('../')
var spawn = require('child_process').spawn
var t = require('tap')
var node = process.execPath
var f = __filename
if (process.argv[2] === 'child') {
for (var i = 0; i < 15; i++) {
onexit(function () {
console.log('ok')
})
}
} else {
t.test('parent', function (t) {
var child = spawn(node, [f, 'child'])
var err = ''
var out = ''
var expectOut = new Array(16).join('ok\n')
child.stderr.on('data', function (c) {
err += c
})
child.stdout.on('data', function (c) {
out += c
})
child.on('close', function (code, signal) {
t.equal(code, 0)
t.equal(signal, null)
t.equal(err, '')
t.equal(out, expectOut)
t.end()
})
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment