From 2e960f1940480c40d3861d18194d05e1ece5e096 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Wed, 1 Jul 2020 00:47:09 -0400 Subject: [PATCH] fixes --- src/class/Util.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/class/Util.ts b/src/class/Util.ts index afa999c..5ecdf5e 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -33,7 +33,7 @@ export default class Util { * @param options childProcess.ExecOptions */ public async exec(command: string, options: childProcess.ExecOptions = {}): Promise { - return new Promise((res, rej) => { + /* return new Promise((res, rej) => { let output = ''; const writeFunction = (data: string|Buffer|Error) => { output += `${data}`; @@ -50,6 +50,13 @@ export default class Util { if (code !== 0) rej(new Error(`Command failed: ${command}\n${output}`)); res(output); }); + }); */ + return new Promise((resolve, reject) => { + childProcess.exec(command, options, (err, stdout, stderr) => { + if (stderr) reject(new Error(`Command failed: ${command}\n${stderr}`)); + if (err) reject(err); + resolve(stdout); + }); }); }