[microdecision] Fix case where stdinfo is not provided

This commit is contained in:
Alexandre Aubin 2019-03-22 01:03:06 +01:00
parent c9d5f9a04a
commit 0a300e50d7

View file

@ -65,6 +65,7 @@ def call_async_output(args, callback, **kwargs):
# if command does not write in the stdinfo pipe...) # if command does not write in the stdinfo pipe...)
stdinfo_f = os.open(stdinfo, os.O_RDONLY | os.O_NONBLOCK) stdinfo_f = os.open(stdinfo, os.O_RDONLY | os.O_NONBLOCK)
else: else:
if "stdinfo" in kwargs:
kwargs.pop("stdinfo") kwargs.pop("stdinfo")
stdinfo = None stdinfo = None
@ -98,12 +99,14 @@ def call_async_output(args, callback, **kwargs):
# this way is not 100% perfect but should do it # this way is not 100% perfect but should do it
stdout_consum.process_next_line() stdout_consum.process_next_line()
stderr_consum.process_next_line() stderr_consum.process_next_line()
if stdinfo:
stdinfo_consum.process_next_line() stdinfo_consum.process_next_line()
time.sleep(.1) time.sleep(.1)
stderr_reader.join() stderr_reader.join()
# clear the queues # clear the queues
stdout_consum.process_current_queue() stdout_consum.process_current_queue()
stderr_consum.process_current_queue() stderr_consum.process_current_queue()
if stdinfo:
stdinfo_consum.process_current_queue() stdinfo_consum.process_current_queue()
else: else:
while not stdout_reader.eof(): while not stdout_reader.eof():