Skip to content

Commit

Permalink
Wait for thread to start
Browse files Browse the repository at this point in the history
  • Loading branch information
ZyX-I committed Dec 2, 2017
1 parent 0c594b0 commit 1b0df9c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/modules/lib/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def __init__(self, lib, dim, cmd, args, cwd=None, env=None):
self.buffer = []
self.child_lock = threading.Lock()
self.shutdown_event = threading.Event()
self.started_event = threading.Event()

def run(self):
with self.child_lock:
Expand All @@ -70,6 +71,7 @@ def run(self):
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:
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 1b0df9c

Please sign in to comment.