summaryrefslogtreecommitdiff
path: root/scripts/Expect.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Expect.py')
-rwxr-xr-xscripts/Expect.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/Expect.py b/scripts/Expect.py
index 2e0c87cf101..c2d816dcd67 100755
--- a/scripts/Expect.py
+++ b/scripts/Expect.py
@@ -107,7 +107,11 @@ class reader(threading.Thread):
try:
while True:
c = self.p.stdout.read(1)
- if not c: break
+ if not c:
+ self.cv.acquire()
+ self.cv.notify()
+ self.cv.release()
+ break
if c == '\r': continue
self.cv.acquire()
@@ -254,6 +258,11 @@ class reader(threading.Thread):
if len(pattern) != olen:
continue
+ # If no match and the process has exited rasise a TIMEOUT
+ if self.p and self.p.poll() is not None:
+ raise TIMEOUT ('timeout exceeded in match\npattern: "%s"\nbuffer: "%s"\n' %
+ (escape(s), escape(buf, False)))
+
if timeout is None:
self.cv.wait()
else: