mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
Fix: properly handle carriage return stripping in ssh.
This commit is contained in:
parent
97efd11b86
commit
e87e4c582c
@ -149,7 +149,8 @@ class SshShell(object):
|
||||
timed_out = not self.conn.prompt(timeout)
|
||||
# the regex removes line breaks potentiall introduced when writing
|
||||
# command to shell.
|
||||
command_index = re.sub(r' \r([^\n])', r'\1', self.conn.before).find(command)
|
||||
output = re.sub(r' \r([^\n])', r'\1', self.conn.before)
|
||||
command_index = output.find(command)
|
||||
while not timed_out and command_index == -1:
|
||||
# In case of a "premature" timeout (i.e. timeout, but no hang,
|
||||
# so command completes afterwards), there may be a prompt from
|
||||
@ -157,9 +158,9 @@ class SshShell(object):
|
||||
# checks for this case by making sure that the original command
|
||||
# is present in the serial output and waiting for the next
|
||||
# prompt if it is not.
|
||||
timed_out = not self.conn.prompt(timeout)
|
||||
command_index = re.sub(r' \r([^\n])', r'\1', self.conn.before).find(command)
|
||||
output = self.conn.before[command_index + len(command):].strip()
|
||||
output = re.sub(r' \r([^\n])', r'\1', self.conn.before)
|
||||
command_index = output.find(command)
|
||||
output = output[command_index + len(command):].strip()
|
||||
if timed_out:
|
||||
raise TimeoutError(command, output)
|
||||
if strip_colors:
|
||||
|
Loading…
x
Reference in New Issue
Block a user