From 6e7845b05202d2ec0a69e54d8df58fe1c9d92e94 Mon Sep 17 00:00:00 2001 From: Bsian Date: Tue, 12 May 2020 17:22:19 +0100 Subject: [PATCH] More stuff --- src/class/Util.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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);