diff options
Diffstat (limited to 'tests/pjsua/run.py')
-rw-r--r-- | tests/pjsua/run.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/pjsua/run.py b/tests/pjsua/run.py index c4dfcfc9..2a6cb9e1 100644 --- a/tests/pjsua/run.py +++ b/tests/pjsua/run.py @@ -161,7 +161,8 @@ class Expect: def wait(self): self.trace("wait") - self.proc.wait() + self.proc.communicate("q") + def trace(self, s): if self.trace_enabled: now = time.time() @@ -177,8 +178,20 @@ def handle_error(errmsg, t, close_processes = True): for p in t.process: p.send("q") p.send("q") - p.expect(const.DESTROYED, False) - p.wait() + is_err = False + try: + ret = p.expect(const.DESTROYED, False) + if not ret: + is_err = True + except: + is_err = True + if is_err: + if sys.hexversion >= 0x02060000: + p.proc.terminate() + else: + p.wait() + else: + p.wait() print "Test completed with error: " + errmsg sys.exit(1) |