[Pkg-javascript-commits] [node-foreground-child] 22/69: Revert "Transparently translate high-order exit code to appropriate signal"
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Aug 25 11:43:03 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-foreground-child.
commit 5d57aa2c59c1e0415f50e48c517ac540f32e0f90
Author: isaacs <i at izs.me>
Date: Sun Dec 27 01:27:26 2015 -0500
Revert "Transparently translate high-order exit code to appropriate signal"
This reverts commit d08660b4fa4ce690b4b82ecfe76a76f5bb8b3071.
As it happens, sh is just weird. Better to leave it as it is.
---
index.js | 7 -------
package.json | 1 -
test/basic.js | 35 -----------------------------------
3 files changed, 43 deletions(-)
diff --git a/index.js b/index.js
index 74711df..d002c2e 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,5 @@
var signalExit = require('signal-exit')
var spawn = require('win-spawn')
-var codeToSignal = require('code-to-signal')
module.exports = function (program, args, cb) {
var arrayIndex = arguments.length
@@ -32,18 +31,12 @@ module.exports = function (program, args, cb) {
var childExited = false
signalExit(function (code, signal) {
- if (code > 128 && !signal)
- signal = codeToSignal(code)
-
child.kill(signal || 'SIGHUP')
})
child.on('close', function (code, signal) {
cb(function () {
childExited = true
- if (code > 128 && !signal)
- signal = codeToSignal(code)
-
if (signal) {
// If there is nothing else keeping the event loop alive,
// then there's a race between a graceful exit and getting
diff --git a/package.json b/package.json
index 01e82ea..d45a61b 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,6 @@
"test": "test"
},
"dependencies": {
- "code-to-signal": "^1.0.2",
"signal-exit": "^2.0.0",
"win-spawn": "^2.0.0"
},
diff --git a/test/basic.js b/test/basic.js
index a677981..d8017a9 100644
--- a/test/basic.js
+++ b/test/basic.js
@@ -124,37 +124,6 @@ t.test('parent emits exit when SIGTERMed', { skip: isZero10OnTravis() }, functio
t.end()
})
-
-t.test('signals using sh', { skip: isWindows() }, function (t) {
- var which = ['parent', 'child', 'nobody']
- which.forEach(function (who) {
- t.test('SIGTERM ' + who, function (t) {
- var prog = '/bin/sh'
- var cmd = [
- process.execPath,
- __filename,
- 'parent',
- 'signalexit',
- who
- ].join(' ')
- var args = ['-c', cmd]
- var child = spawn(prog, args)
- var out = ''
- child.stdout.on('data', function (c) { out += c })
- child.on('close', function (code, signal) {
- if (who === 'nobody')
- t.equal(signal, null)
- else
- t.equal(signal, 'SIGTERM')
- t.equal(out, 'parent exit\n')
- t.end()
- })
- })
- })
- t.end()
-})
-
-
t.test('beforeExitHandler', function (t) {
var codes = [0, 1, 2]
codes.forEach(function (c) {
@@ -179,7 +148,3 @@ function isZero10OnTravis () {
return process.env.TRAVIS && /^v0\.10\.[0-9]+$/.test(process.version) ?
'skip on 0.10 on Travis' : false
}
-
-function isWindows () {
- return process.platform === 'win32' && 'skip on windows'
-}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-foreground-child.git
More information about the Pkg-javascript-commits
mailing list