4 Commits

Author SHA1 Message Date
bcf33c718c 1.0.8 2019-05-22 12:47:38 +02:00
7a8ab962b4 fix(core): add sigkill with 10 second delay 2019-05-22 12:47:38 +02:00
29021a7ffe 1.0.7 2019-05-19 22:23:38 +02:00
ca473dcd2e fix(core): update 2019-05-19 22:23:38 +02:00
4 changed files with 14 additions and 5 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartexit", "name": "@pushrocks/smartexit",
"version": "1.0.6", "version": "1.0.8",
"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.6", "version": "1.0.8",
"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",
@ -21,6 +21,7 @@
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/lik": "^3.0.5" "@pushrocks/lik": "^3.0.5",
"@pushrocks/smartdelay": "^2.0.3"
} }
} }

View File

@ -2,7 +2,7 @@ import * as plugins from './smartexit.plugins';
export class SmartExit { export class SmartExit {
public processesToEnd = new plugins.lik.Objectmap<plugins.childProcess.ChildProcess>(); public processesToEnd = new plugins.lik.Objectmap<plugins.childProcess.ChildProcess>();
/** /**
* adds a process to be exited * adds a process to be exited
* @param childProcessArg * @param childProcessArg
@ -25,7 +25,14 @@ export class SmartExit {
let counter = 1; let counter = 1;
this.processesToEnd.forEach(async childProcessArg => { this.processesToEnd.forEach(async childProcessArg => {
console.log(`killing process #${counter}`); console.log(`killing process #${counter}`);
plugins.smartdelay.delayFor(10000).then(() => {
if (childProcessArg.killed) {
return;
}
childProcessArg.kill('SIGKILL');
})
childProcessArg.kill('SIGINT'); childProcessArg.kill('SIGINT');
counter++; counter++;
}); });
} else { } else {

View File

@ -5,5 +5,6 @@ export { childProcess };
// pushrocks scope // pushrocks scope
import * as lik from '@pushrocks/lik'; import * as lik from '@pushrocks/lik';
import * as smartdelay from '@pushrocks/smartdelay';
export { lik }; export { lik, smartdelay };