Show More
@@ -150,7 +150,8 b' class ProcessHandler(object):' | |||
|
150 | 150 | # can set pexpect's search window to be tiny and it won't matter. |
|
151 | 151 | # We only search for the 'patterns' timeout or EOF, which aren't in |
|
152 | 152 | # the text itself. |
|
153 | child = pexpect.spawn(pcmd, searchwindowsize=1) | |
|
153 | #child = pexpect.spawn(pcmd, searchwindowsize=1) | |
|
154 | child = pexpect.spawn(pcmd) | |
|
154 | 155 | flush = sys.stdout.flush |
|
155 | 156 | while True: |
|
156 | 157 | # res is the index of the pattern that caused the match, so we |
@@ -158,10 +159,10 b' class ProcessHandler(object):' | |||
|
158 | 159 | res_idx = child.expect_list(patterns, self.read_timeout) |
|
159 | 160 | print(child.before[out_size:], end='') |
|
160 | 161 | flush() |
|
161 | # Update the pointer to what we've already printed | |
|
162 | out_size = len(child.before) | |
|
163 | 162 | if res_idx==EOF_index: |
|
164 | 163 | break |
|
164 | # Update the pointer to what we've already printed | |
|
165 | out_size = len(child.before) | |
|
165 | 166 | except KeyboardInterrupt: |
|
166 | 167 | # We need to send ^C to the process. The ascii code for '^C' is 3 |
|
167 | 168 | # (the character is known as ETX for 'End of Text', see |
@@ -173,6 +174,7 b' class ProcessHandler(object):' | |||
|
173 | 174 | out_size = len(child.before) |
|
174 | 175 | child.expect_list(patterns, self.terminate_timeout) |
|
175 | 176 | print(child.before[out_size:], end='') |
|
177 | sys.stdout.flush() | |
|
176 | 178 | except KeyboardInterrupt: |
|
177 | 179 | # Impatient users tend to type it multiple times |
|
178 | 180 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now