Not all the lines of output were captured when running execute()
with capture=True.
if capture:
output = ''
t0 = time.time()
- # repeat until process is running or timeout not occurred
+ # Repeat until the process has stopped and there are no more lines
+ # to read, or until the timeout is up.
while True:
line = p.stdout.readline()
if line:
if log_file_path:
log_file.write(line)
t1 = time.time()
- if p.poll() is not None or (timeout is not None and timeout < t1 - t0):
+ if p.poll() is not None and not line or (timeout is not None and timeout < t1 - t0):
break
# If no exitcode yet, ie. process is still running then it means that timeout occurred.