1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-30 17:50:46 +00:00

utils/ssh.py: Make SshConnection._background() more robust

Raise a better exception when e.g. sudo command is not found.
This commit is contained in:
Douglas Raillard 2021-11-18 18:04:41 +00:00 committed by Marc Bonnici
parent 2b38548463
commit 728b59ad7e

View File

@ -583,7 +583,20 @@ class SshConnection(SshConnectionBase):
timeout=None,
executor=executor,
)
pid = int(stdout_in.readline())
pid = stdout_in.readline()
if not pid:
stderr = stderr_in.read()
if channel.exit_status_ready():
ret = channel.recv_exit_status()
else:
ret = 126
raise subprocess.CalledProcessError(
ret,
command,
b'',
stderr,
)
pid = int(pid)
def create_out_stream(stream_in, stream_out):
"""