mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
host: Concatenate stdout and stderr from command output
Previously any output from stderr was discarded for LocalTargets. Align the behaviour of `execute` to append any stderr output to stdout before returning.
This commit is contained in:
parent
2cfb076e4c
commit
8f3200679c
@ -104,7 +104,7 @@ class LocalConnection(ConnectionBase):
|
||||
command = 'echo {} | sudo -S -- sh -c '.format(quote(password)) + quote(command)
|
||||
ignore = None if check_exit_code else 'all'
|
||||
try:
|
||||
return check_output(command, shell=True, timeout=timeout, ignore=ignore)[0]
|
||||
stdout, stderr = check_output(command, shell=True, timeout=timeout, ignore=ignore)
|
||||
except subprocess.CalledProcessError as e:
|
||||
message = 'Got exit code {}\nfrom: {}\nOUTPUT: {}'.format(
|
||||
e.returncode, command, e.output)
|
||||
@ -112,6 +112,7 @@ class LocalConnection(ConnectionBase):
|
||||
raise TargetTransientError(message)
|
||||
else:
|
||||
raise TargetStableError(message)
|
||||
return stdout + stderr
|
||||
|
||||
def background(self, command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, as_root=False):
|
||||
if as_root and not self.connected_as_root:
|
||||
|
Loading…
x
Reference in New Issue
Block a user