diff --git a/ts/smartshell.classes.smartshell.ts b/ts/smartshell.classes.smartshell.ts index e08746b..b8703c7 100644 --- a/ts/smartshell.classes.smartshell.ts +++ b/ts/smartshell.classes.smartshell.ts @@ -21,6 +21,7 @@ export interface IExecResult { export interface IExecResultStreaming { childProcess: cp.ChildProcess; finalPromise: Promise; + kill: () => void; } // -- SmartShell -- @@ -70,7 +71,11 @@ export class Smartshell { if (streamingArg) { done.resolve({ childProcess: execChildProcess, - finalPromise: childProcessEnded.promise + finalPromise: childProcessEnded.promise, + kill: () => { + // this notation with the - kills the whole process group + process.kill(-execChildProcess.pid); + } }); }