Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
b0b32fd730 | |||
924309ea8e |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartexit",
|
"name": "@pushrocks/smartexit",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartexit",
|
"name": "@pushrocks/smartexit",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"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",
|
||||||
|
14
ts/index.ts
14
ts/index.ts
@ -2,10 +2,22 @@ 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>();
|
||||||
public async addProcess(childProcessArg: plugins.childProcess.ChildProcess) {
|
|
||||||
|
/**
|
||||||
|
* adds a process to be exited
|
||||||
|
* @param childProcessArg
|
||||||
|
*/
|
||||||
|
public addProcess(childProcessArg: plugins.childProcess.ChildProcess) {
|
||||||
this.processesToEnd.add(childProcessArg);
|
this.processesToEnd.add(childProcessArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* removes a process to be exited
|
||||||
|
*/
|
||||||
|
public removeProcess(childProcessArg: plugins.childProcess.ChildProcess) {
|
||||||
|
this.processesToEnd.remove(childProcessArg);
|
||||||
|
}
|
||||||
|
|
||||||
public async killAll() {
|
public async killAll() {
|
||||||
console.log('Checking for remaining child processes before exit...');
|
console.log('Checking for remaining child processes before exit...');
|
||||||
if (this.processesToEnd.getArray().length > 0) {
|
if (this.processesToEnd.getArray().length > 0) {
|
||||||
|
Reference in New Issue
Block a user