forked from engineering/cloudservices
fixes
parent
050335b760
commit
2e960f1940
|
@ -33,7 +33,7 @@ export default class Util {
|
|||
* @param options childProcess.ExecOptions
|
||||
*/
|
||||
public async exec(command: string, options: childProcess.ExecOptions = {}): Promise<string> {
|
||||
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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue