Leonardo Francalanci added the comment:

I have a workaround, and I guess this means there's a bug in the current 
implementation of stdout/stderr=subprocess.PIPE; if I open my own pipes instead 
of using subprocess.PIPE everything seems to work (provided I close the pipe 
before reading from it):

(errPipeR, errPipeW) = os.pipe();
(outPipeR, outPipeW) = os.pipe();

proc = subprocess.Popen(proc_str,
                                    stdin=subprocess.PIPE,
                                    stderr=errPipeW,
                                    stdout=outPipeW,shell=False,
                                    universal_newlines=True)

proc.communicate(timeout=20)
os.close(outPipeW)
os.close(errPipeW)

Now I can read from the "R" pipes with 0 problems (getting the error and output 
streams), and proc.communicate exits as soon as the called process exits (4 
seconds).

So, since I can use my own pipes without any problems, I don't see why the 
regular "subprocess.PIPE" shouldn't be working...

----------

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

Reply via email to