diff options
author | Joel Edwards <joeledwards@gmail.com> | 2013-12-10 14:22:11 -0700 |
---|---|---|
committer | Joel Edwards <joeledwards@gmail.com> | 2013-12-10 14:22:11 -0700 |
commit | 88a50da2a2da3514d2f958abb88cd4d1b1906508 (patch) | |
tree | f1dcd5995a96c98a66fffb829ed8cd11efcc6036 | |
parent | 2bb6888a97c271ce360b9ffc2af70c5fe280db90 (diff) | |
download | pexpect-88a50da2a2da3514d2f958abb88cd4d1b1906508.tar.gz |
Switched to a simpler approache for appending to the prompt
in try_read_prompt thanks to a suggestion from takluyver
-rw-r--r-- | pexpect/pxssh.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/pexpect/pxssh.py b/pexpect/pxssh.py index 0fef996..cbc07fe 100644 --- a/pexpect/pxssh.py +++ b/pexpect/pxssh.py @@ -159,18 +159,14 @@ class pxssh (spawn): # maximum time for reading the entire prompt total_timeout = timeout_multiplier * 3.0 - prompt = None + prompt = b'' begin = time.time() expired = 0.0 timeout = first_char_timeout while expired < total_timeout: try: - c = self.read_nonblocking(size=1, timeout=timeout) - if prompt is None: - prompt = c - else: - prompt += c + prompt += self.read_nonblocking(size=1, timeout=timeout) expired = time.time() - begin # updated total time expired timeout = inter_char_timeout except TIMEOUT: @@ -178,11 +174,7 @@ class pxssh (spawn): # inter_char_timeout will drop us out of the loop quickly expired = total_timeout - result = '' - if prompt is not None: - result = prompt - - return result + return prompt def sync_original_prompt (self, sync_multiplier=1.0): |