Skip to content

Commit edbaec9

Browse files
committed
pexpect: Don't try to get matches from TIMEOUT
If we match TIMEOUT then trying to retrieve the matches will throw an exception, and also can't give us any useful information, so skip it.
1 parent 497db1f commit edbaec9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/pexpect_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ def expect(self, patterns, timeout=-1, bug_patterns=None):
7171
patterns.extend(bug_patterns)
7272

7373
idx = self.child.expect(patterns, timeout=timeout)
74-
logging.debug("Matched: '%s' %s", self.get_match(), self.matches())
74+
if self.child.match == pexpect.TIMEOUT:
75+
logging.debug("Timed out looking for a match")
76+
else:
77+
logging.debug("Matched: '%s' %s", self.get_match(), self.matches())
7578

7679
if idx >= len(patterns) - len(bug_patterns):
7780
self.drain_and_terminate(self.child, "Error: saw oops/warning etc. while expecting")

0 commit comments

Comments
 (0)