Attempt at a fix?
parent
d098ac1832
commit
1aeb51eb7a
|
@ -37,8 +37,6 @@ export default class Util {
|
|||
let output = '';
|
||||
const writeFunction = (data: string|Buffer|Error) => {
|
||||
if (data instanceof Error) error = true;
|
||||
if (data instanceof Error) this.client.getDMChannel('253600545972027394').then((c) => c.createMessage('error'));
|
||||
this.client.getDMChannel('253600545972027394').then((c) => c.createMessage(data.toString()));
|
||||
output += `${data}`;
|
||||
};
|
||||
const cmd = childProcess.exec(command, options);
|
||||
|
@ -49,7 +47,7 @@ export default class Util {
|
|||
cmd.stdout.off('data', writeFunction);
|
||||
cmd.stderr.off('data', writeFunction);
|
||||
cmd.off('error', writeFunction);
|
||||
if (error) rej(new Error(output));
|
||||
if (code !== 0) rej(new Error(output));
|
||||
res(output);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue