2 Commits

Author SHA1 Message Date
0d0404d00d 1.0.9 2019-05-23 17:53:17 +02:00
44414ab1b4 fix(core): now killing groups of processes with negative pid 2019-05-23 17:53:16 +02:00
3 changed files with 7 additions and 6 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartexit", "name": "@pushrocks/smartexit",
"version": "1.0.8", "version": "1.0.9",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartexit", "name": "@pushrocks/smartexit",
"version": "1.0.8", "version": "1.0.9",
"private": false, "private": false,
"description": "do things before one exists a process", "description": "do things before one exists a process",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -24,14 +24,15 @@ export class SmartExit {
console.log('found remaining child processes'); console.log('found remaining child processes');
let counter = 1; let counter = 1;
this.processesToEnd.forEach(async childProcessArg => { this.processesToEnd.forEach(async childProcessArg => {
console.log(`killing process #${counter}`); const pid = childProcessArg.pid;
console.log(`killing process #${counter} with pid ${pid}`);
plugins.smartdelay.delayFor(10000).then(() => { plugins.smartdelay.delayFor(10000).then(() => {
if (childProcessArg.killed) { if (childProcessArg.killed) {
return; return;
} }
childProcessArg.kill('SIGKILL'); process.kill(-pid, 'SIGKILL');
}) });
childProcessArg.kill('SIGINT'); process.kill(-pid, 'SIGINT');
counter++; counter++;
}); });