From 4846d363545403c27eb2e3a76a9ab718e40422d1 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 3 Apr 2021 11:10:13 -0400 Subject: [PATCH] Fix --- commands/util/exec.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/commands/util/exec.js b/commands/util/exec.js index e1ae432a..7d29ca90 100644 --- a/commands/util/exec.js +++ b/commands/util/exec.js @@ -40,11 +40,7 @@ module.exports = class ExecCommand extends Command { } async exec(command) { - try { - const stdout = await execAsync(command, { timeout: 30000, encoding: 'utf8' }); - return { err: false, std: stdout.trim() }; - } catch (err) { - return { err: true, std: err.stderr.trim() }; - } + const { stdout, stderr } = await execAsync(command, { timeout: 30000, encoding: 'utf8' }); + return { err: Boolean(stderr), std: stderr ? stderr.trim() : stdout.trim() }; } };