[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

Eryk Sun report at bugs.python.org
Fri Sep 15 14:03:38 EDT 2017


Eryk Sun added the comment:

> I tried with stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, 
> stderr=subprocess.DEVNULL

As I said previously, you also need to make the current standard handles non-inheritable. Pending issue 19764, in 3.7 you'll be able to override stdin, stdout, and stderr with the default close_fds=True. Currently overriding them implicitly sets close_fds=False, in which case you need to manually ensure that the current standard handles (i.e. the pipe handles) can't be inherited. For example:

    os.set_inheritable(0, False)
    os.set_inheritable(1, False)
    os.set_inheritable(2, False)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31447>
_______________________________________


More information about the Python-bugs-list mailing list