Do not use child.wait(), it hangs

This commit is contained in:
ZyX 2015-02-21 16:50:25 +03:00
parent 0710f2760f
commit 0a87b558d9
1 changed files with 9 additions and 1 deletions

View File

@ -12,6 +12,8 @@ from io import BytesIO
import pexpect
from powerline.lib.monotonic import monotonic
def get_argparser(ArgumentParser=argparse.ArgumentParser):
parser = ArgumentParser(description='Run powerline shell test using pexpect')
@ -96,7 +98,13 @@ def main():
sleep(1)
# TODO Implement something more smart
child.wait()
start = monotonic()
while child.isalive():
sleep(0.1)
if monotonic() - start > 60 * 3:
# Waiting for three minutes. This is long enough.
child.kill()
break
with open(full_log_file_name, 'wb') as LF:
LF.write(child.read())