Fix #21
This commit is contained in:
parent
5d8c285b06
commit
bc4e7823bc
4 changed files with 111 additions and 22 deletions
|
|
@ -6,15 +6,24 @@ export class ChildProcess {
|
|||
static async spawnAsync(executable: string, args: string[]): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
|
||||
let output: string = '';
|
||||
let handle = child_process.spawn(executable, args);
|
||||
|
||||
handle.stdout.on('data', (data: string) => {
|
||||
output += data;
|
||||
});
|
||||
|
||||
handle.stderr.on('data', (data: string) => {
|
||||
output += data;
|
||||
});
|
||||
|
||||
handle.on('close', (code: string) => {
|
||||
if (code == '0') {
|
||||
resolve();
|
||||
}
|
||||
|
||||
else {
|
||||
reject(code);
|
||||
reject({ code: code, message: output });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue