1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-07-17 04:23:29 +01:00

LinuxDevice: error output for pull/push_file

Standard string representation of a subprocess.CalledProcessError does
not include the output of the command, so it was not previsouly included
in the resulting DeviceError. This commit ensures that the output is
propagated, regardless of whether it came from stdout or stderr of the
underlying process.
This commit is contained in:
Sergei Trofimov
2016-06-23 11:50:19 +01:00
parent a6355885fc
commit 242df842bc
3 changed files with 11 additions and 4 deletions

@ -26,8 +26,8 @@ import shutil
from pexpect import EOF, TIMEOUT, spawn, pxssh
from wlauto.exceptions import HostError, DeviceError, TimeoutError, ConfigError
from wlauto.utils.misc import which, strip_bash_colors, escape_single_quotes, check_output
from wlauto.utils.misc import (which, strip_bash_colors, escape_single_quotes, check_output,
CalledProcessErrorWithStderr)
ssh = None
scp = None
@ -243,7 +243,9 @@ class SshShell(object):
try:
check_output(command, timeout=timeout, shell=True)
except subprocess.CalledProcessError as e:
raise subprocess.CalledProcessError(e.returncode, e.cmd.replace(pass_string, ''), e.output)
raise CalledProcessErrorWithStderr(e.returncode,
e.cmd.replace(pass_string, ''),
e.output, getattr(e, 'error', ''))
except TimeoutError as e:
raise TimeoutError(e.command.replace(pass_string, ''), e.output)