Skip to content

Commit 15bf9b6

Browse files
committed
pexpect: Simplify drain_and_terminate()
1 parent 36811c4 commit 15bf9b6

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

lib/pexpect_utils.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,8 @@ def terminate(self):
3939
self.wait_for_exit()
4040

4141
def drain_and_terminate(self):
42-
# Wait for the end of the oops, if it is one
43-
try:
44-
idx = self.child.expect(['--\[ end trace', pexpect.TIMEOUT], timeout=10)
45-
except pexpect.exceptions.EOF:
46-
idx = -1
47-
pass
48-
49-
if idx == 1:
50-
# That didn't match, let it run for a bit
51-
time.sleep(5)
52-
42+
# Wait for 10s out of output, which should give oopses time to be logged
43+
self.child.expect([pexpect.TIMEOUT, pexpect.EOF], timeout=10)
5344
self.terminate()
5445

5546
def get_match(self, i=0):

0 commit comments

Comments
 (0)