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

Eryk Sun report at bugs.python.org
Thu Sep 14 03:53:03 EDT 2017


Eryk Sun added the comment:

> Now I can read from the "R" pipes with 0 problems (getting the error 
> and output streams)

The pipe handles are inherited by waitfor.exe, just as before. You'll find that reading to EOF will block just as it does when using subprocess.PIPE with communicate(). For example:

    stderr = open(errPipeR, 'r')
    err = stderr.read()

The above stderr.read() will return when waitfor.exe either exits or gets terminated.

> and proc.communicate exits as soon as the called process exits 
> (4 seconds).

proc.stdout and proc.stderr are None in this case, so all communicate() can do is write to proc.stdin, if there's input text, and then wait() for the process to exit.

----------

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


More information about the Python-bugs-list mailing list