mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
LocalConnection: Enrich TargetError message from execute method
Add exit code, command, and output to TargetError exception message when execute fails. This brings LocalConnection into line with AdbConnection and SshConnection.
This commit is contained in:
parent
b587049eb9
commit
179e45f98e
@ -60,7 +60,9 @@ class LocalConnection(object):
|
|||||||
try:
|
try:
|
||||||
return check_output(command, shell=True, timeout=timeout, ignore=ignore)[0]
|
return check_output(command, shell=True, timeout=timeout, ignore=ignore)[0]
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
raise TargetError(e)
|
message = 'Got exit code {}\nfrom: {}\nOUTPUT: {}'.format(
|
||||||
|
e.returncode, command, e.output)
|
||||||
|
raise TargetError(message)
|
||||||
|
|
||||||
def background(self, command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, as_root=False):
|
def background(self, command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, as_root=False):
|
||||||
if as_root:
|
if as_root:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user