[Pkg-javascript-commits] [node-signal-exit] 01/03: New upstream version 3.0.2
Paolo Greppi
paolog-guest at moszumanska.debian.org
Mon Oct 30 16:31:28 UTC 2017
This is an automated email from the git hooks/post-receive script.
paolog-guest pushed a commit to branch master
in repository node-signal-exit.
commit 7266d64c3cd0dbf4b8597daf465fecb80723a399
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date: Mon Oct 30 13:07:43 2017 +0100
New upstream version 3.0.2
---
LICENSE.txt | 2 ++
index.js | 9 +++++++++
package.json | 6 +++---
test/many-handlers.js | 33 +++++++++++++++++++++++++++++++++
4 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/LICENSE.txt b/LICENSE.txt
index c7e2747..eead04a 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,3 +1,5 @@
+The ISC License
+
Copyright (c) 2015, Contributors
Permission to use, copy, modify, and/or distribute this software
diff --git a/index.js b/index.js
index 7dd8d91..337f691 100644
--- a/index.js
+++ b/index.js
@@ -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')
diff --git a/package.json b/package.json
index 5cd4455..50364cc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"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"
}
}
diff --git a/test/many-handlers.js b/test/many-handlers.js
new file mode 100644
index 0000000..93b923c
--- /dev/null
+++ b/test/many-handlers.js
@@ -0,0 +1,33 @@
+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()
+ })
+ })
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-signal-exit.git
More information about the Pkg-javascript-commits
mailing list