This commit is contained in:
Dragon Fire
2021-04-03 11:12:34 -04:00
parent 4846d36354
commit e33c247160
+6 -2
View File
@@ -40,7 +40,11 @@ module.exports = class ExecCommand extends Command {
}
async exec(command) {
const { stdout, stderr } = await execAsync(command, { timeout: 30000, encoding: 'utf8' });
return { err: Boolean(stderr), std: stderr ? stderr.trim() : stdout.trim() };
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() };
}
}
};