From 0e751bdd73d422268a30cbcd699038f4573f1f7e Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Thu, 30 Apr 2015 12:35:50 +0100 Subject: [PATCH] Handling duplicate prompt in pxssh in a slightly differnt way. --- wlauto/utils/ssh.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/wlauto/utils/ssh.py b/wlauto/utils/ssh.py index ffb7244d..75830d46 100644 --- a/wlauto/utils/ssh.py +++ b/wlauto/utils/ssh.py @@ -135,6 +135,7 @@ class SshShell(object): def _execute_and_wait_for_prompt(self, command, timeout=None, as_root=False, strip_colors=True, log=True): timeout = self.timeout if timeout is None else timeout + self.conn.prompt(0.1) # clear an existing prompt if there is one. if as_root: command = "sudo -- sh -c '{}'".format(escape_single_quotes(command)) if log: @@ -154,15 +155,6 @@ class SshShell(object): # command to shell. 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 - # the previous command completion in the serial output. This - # 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. - 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)