1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

utils/ssh.py: try to make failure to parse response more obvious

This commit is contained in:
Volker Eckert 2018-11-07 20:17:48 +00:00 committed by Marc Bonnici
parent c4c76ebcf8
commit 5e13a045a3

View File

@ -205,9 +205,13 @@ class SshConnection(object):
try: try:
with self.lock: with self.lock:
_command = '({}); __devlib_ec=$?; echo; echo $__devlib_ec'.format(command) _command = '({}); __devlib_ec=$?; echo; echo $__devlib_ec'.format(command)
raw_output = self._execute_and_wait_for_prompt( full_output = self._execute_and_wait_for_prompt(_command, timeout, as_root, strip_colors)
_command, timeout, as_root, strip_colors) split_output = full_output.rsplit('\r\n', 2)
output, exit_code_text, _ = raw_output.rsplit('\r\n', 2) try:
output, exit_code_text, _ = split_output
except ValueError as e:
raise TargetStableError(
"cannot split reply (target misconfiguration?):\n'{}'".format(full_output))
if check_exit_code: if check_exit_code:
try: try:
exit_code = int(exit_code_text) exit_code = int(exit_code_text)