From 1b0df9c2bd488bde74f73e585f1fee3db6275938 Mon Sep 17 00:00:00 2001 From: Foo Date: Sat, 2 Dec 2017 17:32:42 +0300 Subject: [PATCH] Wait for thread to start --- tests/modules/lib/terminal.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/modules/lib/terminal.py b/tests/modules/lib/terminal.py index 7d2c7667..540135dc 100644 --- a/tests/modules/lib/terminal.py +++ b/tests/modules/lib/terminal.py @@ -61,6 +61,7 @@ class ExpectProcess(threading.Thread): self.buffer = [] self.child_lock = threading.Lock() self.shutdown_event = threading.Event() + self.started_event = threading.Event() def run(self): with self.child_lock: @@ -70,6 +71,7 @@ class ExpectProcess(threading.Thread): child.setwinsize(self.dim.rows, self.dim.cols) sleep(0.5) self.child = child + self.started_event.set() status = None while status is None and not self.shutdown_event.is_set(): try: @@ -270,6 +272,7 @@ def do_terminal_tests(tests, cmd, dim, args, env, suite, cwd=None, fin_cb=None, env=env, ) p.start() + p.started_event.wait() ret = True