From 7a8ab962b4ee8384683ba6c2249f532f67e1c033 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Wed, 22 May 2019 12:47:38 +0200 Subject: [PATCH] fix(core): add sigkill with 10 second delay --- package.json | 3 ++- ts/index.ts | 7 +++++++ ts/smartexit.plugins.ts | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ac55be0..c886470 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "tslint-config-prettier": "^1.15.0" }, "dependencies": { - "@pushrocks/lik": "^3.0.5" + "@pushrocks/lik": "^3.0.5", + "@pushrocks/smartdelay": "^2.0.3" } } diff --git a/ts/index.ts b/ts/index.ts index c42ebcf..6b096a3 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -25,7 +25,14 @@ export class SmartExit { let counter = 1; this.processesToEnd.forEach(async childProcessArg => { console.log(`killing process #${counter}`); + plugins.smartdelay.delayFor(10000).then(() => { + if (childProcessArg.killed) { + return; + } + childProcessArg.kill('SIGKILL'); + }) childProcessArg.kill('SIGINT'); + counter++; }); } else { diff --git a/ts/smartexit.plugins.ts b/ts/smartexit.plugins.ts index 6ad743d..92ce562 100644 --- a/ts/smartexit.plugins.ts +++ b/ts/smartexit.plugins.ts @@ -5,5 +5,6 @@ export { childProcess }; // pushrocks scope import * as lik from '@pushrocks/lik'; +import * as smartdelay from '@pushrocks/smartdelay'; -export { lik }; +export { lik, smartdelay };