from datetime import datetime, timedelta
from functools import partial
-from oeqa.utils.commands import runCmd, get_bb_vars
+from oeqa.utils.commands import CommandError, runCmd, get_bb_vars
from oeqa.utils.git import GitError, GitRepo
# Get logger for this module
def log_cmd_output(self, cmd):
"""Run a command and log it's output"""
+ cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd)
+ log.info("Logging command: %s", cmd_str)
cmd_log = os.path.join(self.out_dir, 'commands.log')
- with open(cmd_log, 'a') as fobj:
- runCmd2(cmd, stdout=fobj)
+ try:
+ with open(cmd_log, 'a') as fobj:
+ runCmd2(cmd, stdout=fobj)
+ except CommandError as err:
+ log.error("Command failed: %s", err.retcode)
+ raise
def measure_cmd_resources(self, cmd, name, legend):
"""Measure system resource usage of a command"""