This commit is contained in:
Dragon Fire
2021-04-03 11:10:13 -04:00
parent b4b64a935f
commit 4846d36354
+2 -6
View File
@@ -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() };
}
};