@travetto/exec
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -10,3 +10,5 @@ { | ||
"@types/cross-spawn": "^6.0.0", | ||
"cross-spawn": "^6.0.5" | ||
"@types/rimraf": "^2.0.2", | ||
"cross-spawn": "^6.0.5", | ||
"rimraf": "^2.6.2" | ||
}, | ||
@@ -20,3 +22,3 @@ "description": "", | ||
}, | ||
"version": "0.0.10" | ||
"version": "0.0.11" | ||
} |
@@ -7,2 +7,3 @@ import * as child_process from 'child_process'; | ||
export class ChildExecution<U extends ExecutionEvent = ExecutionEvent> extends Execution<U, child_process.ChildProcess> { | ||
constructor(public command: string, public fork = false, public opts: ChildOptions = {}) { | ||
@@ -39,2 +40,17 @@ super(); | ||
async waitForComplete() { | ||
await this._init(); | ||
return new Promise((resolve, reject) => { | ||
this._proc.on('close', () => { | ||
resolve(); | ||
}); | ||
this._proc.on('exit', () => { | ||
resolve(); | ||
}); | ||
this._proc.on('error', (err) => { | ||
reject(err); | ||
}); | ||
}); | ||
} | ||
kill() { | ||
@@ -41,0 +57,0 @@ if (this._proc) { |
@@ -15,2 +15,3 @@ import * as child_process from 'child_process'; | ||
valid: boolean; | ||
killed?: boolean; | ||
} | ||
@@ -17,0 +18,0 @@ |
@@ -47,3 +47,3 @@ import * as cp from 'child_process'; | ||
} | ||
finish({ code: 1, stderr, stdout, message: `Execution timed out after: ${timeout} ms`, valid: false }); | ||
finish({ code: 1, stderr, stdout, message: `Execution timed out after: ${timeout} ms`, valid: false, killed: true }); | ||
}, timeout); | ||
@@ -67,3 +67,3 @@ } | ||
type WithOpts<T> = T & ExecutionOptions; | ||
export type WithOpts<T> = T & ExecutionOptions; | ||
@@ -70,0 +70,0 @@ export function spawn(cmdStr: string, options: WithOpts<cp.SpawnOptions> = {}): [cp.ChildProcess, Promise<ExecutionResult>] { |
13187
16
425
6
+ Added@types/rimraf@^2.0.2
+ Addedrimraf@^2.6.2
+ Added@types/glob@8.1.0(transitive)
+ Added@types/minimatch@5.1.2(transitive)
+ Added@types/rimraf@2.0.5(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedwrappy@1.0.2(transitive)