Use “non-blocking” read and stop on TIMEOUT and EOF

This commit is contained in:
ZyX 2015-02-21 18:05:04 +03:00
parent deee40505d
commit b7c7d29aa0
1 changed files with 9 additions and 1 deletions

View File

@ -98,7 +98,15 @@ def main():
# TODO Implement something more smart # TODO Implement something more smart
with open(full_log_file_name, 'wb') as LF: with open(full_log_file_name, 'wb') as LF:
LF.write(child.read()) while True:
try:
s = child.read_nonblocking(1000)
except pexpect.TIMEOUT:
break
except pexpect.EOF:
break
else:
LF.write(s)
check_call([ check_call([
os.path.join('tests', 'shell', 'path', 'python'), os.path.join('tests', 'shell', 'path', 'python'),