pmoravec <pmora...@redhat.com> added the comment:

> The "poll" method does not wait for the child to exit. Normally you use the 
> "wait" method in this situation. I suspect this is a bug in the application, 
> not in Python.

Thanks for clarification. Could you please confirm what code change in that 
script is safe, then?

1) looping "while p.poll() == None   pass" to really ensure some status is 
returned.

2) calling p.wait() before p.poll()

>From a blackbox perspective, I would expect either to provide similar fixing 
>mechanism of my script. But as we call this code snippet concurrently, for 
>random commands that randomly terminates with random outcome / status, can't 
>either fix attempt cause e.g. a deadlock?

Thanks in advance for help / advice.

(just for context if it matters: the snippet is from 
https://github.com/sosreport/sos/blob/master/sos/utilities.py#L158 where the 
sos_get_command_output method is called concurrently by more threads)

----------
nosy: +pmoravec

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34566>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to