[issue1191964] add non-blocking read and write methods to subprocess.Popen

STINNER Victor report at bugs.python.org
Thu Jul 24 13:45:05 CEST 2014


STINNER Victor added the comment:

> Do Popen.write_nonblocking() and Popen.read_nonblocking() methods
> belong to the second category? Should they raise BrokenPipeError?

IMO when you write directly to stdin and read from stdout/stderr of a
child process, your code should be written to handle BrokenPipeError.
You must decide how to handle them. Otherwise, you have to poll
manually the child process using proc.poll() which is less efficient.

If you forget to poll the process, your program may enter an unlimited
loop which only occur in some cases (bug in the child process which
exits before reading the whole stdin input).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1191964>
_______________________________________


More information about the Python-bugs-list mailing list