Attempt at a fix?

merge-requests/4/head
Bsian 2020-05-12 17:10:34 +01:00
parent d098ac1832
commit 1aeb51eb7a
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 1 additions and 3 deletions

View File

@ -37,8 +37,6 @@ export default class Util {
let output = ''; let output = '';
const writeFunction = (data: string|Buffer|Error) => { const writeFunction = (data: string|Buffer|Error) => {
if (data instanceof Error) error = true; 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}`; output += `${data}`;
}; };
const cmd = childProcess.exec(command, options); const cmd = childProcess.exec(command, options);
@ -49,7 +47,7 @@ export default class Util {
cmd.stdout.off('data', writeFunction); cmd.stdout.off('data', writeFunction);
cmd.stderr.off('data', writeFunction); cmd.stderr.off('data', writeFunction);
cmd.off('error', writeFunction); cmd.off('error', writeFunction);
if (error) rej(new Error(output)); if (code !== 0) rej(new Error(output));
res(output); res(output);
}); });
}); });