Skip to content

Commit df71df1

Browse files
authored
Merge pull request #155 from strongloop/update
[semver-major] Update supported Node versions
2 parents 008f162 + 0719242 commit df71df1

File tree

6 files changed

+56
-16
lines changed

6 files changed

+56
-16
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
language: node_js
22
node_js:
3+
- "10"
4+
- "8"
35
- "6"
4-
- "5"
5-
- "4"
6-
- "0.12"
7-
- "0.10"

appveyor.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
environment:
22
matrix:
3+
- nodejs_version: '10'
4+
- nodejs_version: '8'
35
- nodejs_version: '6'
4-
- nodejs_version: '5'
5-
- nodejs_version: '4'
6-
- nodejs_version: '0.12'
7-
- nodejs_version: '0.10'
86
install:
97
- ps: Install-Product node $env:nodejs_version
108
- set CI=true

lib/proc.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function run(key, proc, emitter) {
2929
args = ['-c', proc.command];
3030
}
3131
var child = prog.spawn(file, args, { env: proc.env });
32+
var killallReceived = false;
3233

3334
child.stdout.on('data', function(data) {
3435
cons.log(key, proc, data.toString());
@@ -38,20 +39,35 @@ function run(key, proc, emitter) {
3839
cons.log(key, proc, data.toString());
3940
});
4041

41-
child.on('close', function(code) {
42+
child.on('close', function(code, signal) {
4243
if(code === 0) {
4344
cons.info(key, proc, "Exited Successfully");
4445
} else {
45-
cons.error(key, proc, "Exited with exit code " + code);
46+
cons.error(key, proc, "Exited with exit code " + signal || code);
4647
}
4748
});
4849

4950
child.on('exit', function(code, signal) {
50-
emitter.emit('killall', signal);
51+
if (!killallReceived) {
52+
emitter.emit('killall', signal || 'SIGINT');
53+
}
5154
});
5255

5356
emitter.on('killall', function(signal) {
54-
child.kill(signal);
57+
// Once this process has received a killall event, don't send another
58+
// such event to everyone. Let's assume that once is enough.
59+
killallReceived = true;
60+
61+
try {
62+
child.kill(signal);
63+
}
64+
catch (err) {
65+
if (err.code === 'EPERM') {
66+
// Means that the child runs with higher privileges than we are; we're
67+
// not going to be able to kill it in that state. Log and do nothing.
68+
cons.error(key, proc, "Process has become unkillable; returns EPERM.");
69+
}
70+
}
5571
});
5672

5773
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
"test": "tap test/*.test.*"
2727
},
2828
"dependencies": {
29-
"commander": "~2.9.0",
30-
"http-proxy": "~1.11.1",
29+
"commander": "^2.15.1",
30+
"http-proxy": "^1.17.0",
3131
"mustache": "^2.2.1",
32-
"shell-quote": "~1.4.2"
32+
"shell-quote": "^1.6.1"
3333
},
3434
"repository": {
3535
"type": "git",
@@ -40,7 +40,7 @@
4040
"email": "[email protected]"
4141
},
4242
"engines": {
43-
"node": ">=0.6.9"
43+
"node": ">=6"
4444
},
4545
"preferGlobal": true,
4646
"devDependencies": {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
NF="node ../nf.js"
4+
5+
rm -rf sandbox
6+
mkdir -p sandbox
7+
8+
# We'll exit with a code that cannot be used as a signal. This exposes a
9+
# potential bug in termination handling.
10+
printf "exitwithcode: sleep 0.1; exit 132" > sandbox/Procfile
11+
node ../nf.js --procfile sandbox/Procfile start >sandbox/signals.txt 2>&1 && exit 0
12+
13+
exit 1
14+

test/handle-eperm.test.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
NF="node ../nf.js"
4+
5+
rm -rf sandbox
6+
mkdir -p sandbox
7+
8+
# We'll exit with a code that cannot be used as a signal. This exposes a
9+
# potential bug in termination handling.
10+
printf "exitwithcode: sudo sleep 1\ncrashafterawhile: sleep 0.5; exit 123" > sandbox/Procfile
11+
node ../nf.js --procfile sandbox/Procfile start >sandbox/eperm.txt 2>&1 && exit 0
12+
13+
exit 1
14+

0 commit comments

Comments
 (0)