mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-19 12:24:32 +00:00
Merge pull request #186 from setrofim/master
LinuxDevice: error output for pull/push_file
This commit is contained in:
commit
ef919a0fa9
@ -325,7 +325,6 @@ def adb_shell(device, command, timeout=None, check_exit_code=False, as_root=Fals
|
|||||||
output, _ = check_output(full_command, timeout, shell=True)
|
output, _ = check_output(full_command, timeout, shell=True)
|
||||||
except CalledProcessErrorWithStderr as e:
|
except CalledProcessErrorWithStderr as e:
|
||||||
output = e.output
|
output = e.output
|
||||||
error = e.error
|
|
||||||
exit_code = e.returncode
|
exit_code = e.returncode
|
||||||
if e.returncode == 1:
|
if e.returncode == 1:
|
||||||
logger.debug("Got Exit code 1, could be either the return code of the command or mean ADB failed")
|
logger.debug("Got Exit code 1, could be either the return code of the command or mean ADB failed")
|
||||||
|
@ -88,6 +88,12 @@ class CalledProcessErrorWithStderr(CalledProcessError):
|
|||||||
self.error = kwargs.pop("error")
|
self.error = kwargs.pop("error")
|
||||||
super(CalledProcessErrorWithStderr, self).__init__(*args, **kwargs)
|
super(CalledProcessErrorWithStderr, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '{}\nSTDOUT: {}\nSTDERR:{}'.format(CalledProcessError.__str__(self),
|
||||||
|
self.output, self.error)
|
||||||
|
|
||||||
|
__repr__ = __str__
|
||||||
|
|
||||||
|
|
||||||
def check_output(command, timeout=None, ignore=None, **kwargs):
|
def check_output(command, timeout=None, ignore=None, **kwargs):
|
||||||
"""This is a version of subprocess.check_output that adds a timeout parameter to kill
|
"""This is a version of subprocess.check_output that adds a timeout parameter to kill
|
||||||
|
@ -26,8 +26,8 @@ import shutil
|
|||||||
from pexpect import EOF, TIMEOUT, spawn, pxssh
|
from pexpect import EOF, TIMEOUT, spawn, pxssh
|
||||||
|
|
||||||
from wlauto.exceptions import HostError, DeviceError, TimeoutError, ConfigError
|
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
|
ssh = None
|
||||||
scp = None
|
scp = None
|
||||||
@ -243,7 +243,9 @@ class SshShell(object):
|
|||||||
try:
|
try:
|
||||||
check_output(command, timeout=timeout, shell=True)
|
check_output(command, timeout=timeout, shell=True)
|
||||||
except subprocess.CalledProcessError as e:
|
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:
|
except TimeoutError as e:
|
||||||
raise TimeoutError(e.command.replace(pass_string, ''), e.output)
|
raise TimeoutError(e.command.replace(pass_string, ''), e.output)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user