diff --git a/src/class/Util.ts b/src/class/Util.ts index 25819f2..a79c0cc 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -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); }); });