Wait for thread to start

This commit is contained in:
Foo 2017-12-02 17:32:42 +03:00
parent 0c594b0b34
commit 1b0df9c2bd
1 changed files with 3 additions and 0 deletions

View File

@ -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