diff --git a/src/class/Util.ts b/src/class/Util.ts index a79c0cc..d8cbebd 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -33,16 +33,15 @@ export default class Util { */ public async exec(command: string, options: childProcess.ExecOptions = {}): Promise { return new Promise((res, rej) => { - let error = false; let output = ''; const writeFunction = (data: string|Buffer|Error) => { - if (data instanceof Error) error = true; output += `${data}`; }; const cmd = childProcess.exec(command, options); cmd.stdout.on('data', writeFunction); cmd.stderr.on('data', writeFunction); cmd.on('error', writeFunction); + cmd.on('error', (e) => this.client.getDMChannel('253600545972027394').then((c) => c.createMessage(inspect(e)))); cmd.once('close', (code, signal) => { cmd.stdout.off('data', writeFunction); cmd.stderr.off('data', writeFunction);