[fix] edgy bug on slow hardware, especially on our (futur) CI

This commit is contained in:
Laurent Peuch 2016-12-07 22:04:46 +01:00
parent 29fa237863
commit 8c4104bd90

View file

@ -81,6 +81,17 @@ def call_async_output(args, callback, **kwargs):
time.sleep(.1)
stdout_reader.join()
stdout_consum.join()
# on slow hardware, in very edgy situations it is possible that the process
# isn't finished just after having closed stdout and stderr, so we wait a
# bit to give hime the time to finish (while having a timeout)
# Note : p.poll() returns None is the process hasn't finished yet
start = time.time()
while time.time() - start < 10:
if p.poll() is not None:
return p.poll()
time.sleep(.1)
return p.poll()