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() }; } };