6 Commits

Author SHA1 Message Date
466a03e27b 1.0.15 2019-05-28 10:34:57 +02:00
fe5e220087 fix(core): update 2019-05-28 10:34:57 +02:00
7ad7749ba7 1.0.14 2019-05-28 10:28:57 +02:00
3f0c9e9fe0 fix(core): update 2019-05-28 10:28:56 +02:00
c1a8c638bf 1.0.13 2019-05-28 10:18:10 +02:00
5d6f5ed282 fix(core): update 2019-05-28 10:18:10 +02:00
3 changed files with 9 additions and 7 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartexit", "name": "@pushrocks/smartexit",
"version": "1.0.12", "version": "1.0.15",
"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.12", "version": "1.0.15",
"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

@ -32,9 +32,9 @@ export class SmartExit {
if (childProcessArg.killed) { if (childProcessArg.killed) {
return; return;
} }
process.kill(-pid, 'SIGKILL'); process.kill(pid, 'SIGKILL');
}); });
process.kill(-pid, 'SIGINT'); process.kill(pid, 'SIGINT');
counter++; counter++;
}); });
@ -49,15 +49,17 @@ export class SmartExit {
if (code === 0) { if (code === 0) {
ora.text('Process wants to exit'); ora.text('Process wants to exit');
await this.killAll(); await this.killAll();
}
ora.finishSuccess('Exited ok!'); ora.finishSuccess('Exited ok!');
} else {
ora.finishFail('Exited NOT OK!');
}
}); });
// catch ctrl+c event and exit normally // catch ctrl+c event and exit normally
process.on('SIGINT', async () => { process.on('SIGINT', async () => {
ora.text('Ctrl-C... or SIGINT signal received!'); ora.text('Ctrl-C... or SIGINT signal received!');
await this.killAll(); await this.killAll();
ora.finishSuccess('Exited ok!'); process.exit(0);
}); });
//catch uncaught exceptions, trace, then exit normally //catch uncaught exceptions, trace, then exit normally
@ -65,7 +67,7 @@ export class SmartExit {
ora.text('SMARTEXIT: uncaught exception...'); ora.text('SMARTEXIT: uncaught exception...');
console.log(err); console.log(err);
await this.killAll(); await this.killAll();
ora.finishSuccess('Exited ok!'); process.exit(1);
}); });
} }
} }