![]() If this is to be supported and fixed, the selectors used in POpen._communicate on the POSIX side presumably don't bother to look at buffered IO objects buffer. That depends on your read patterns and child process. What is your use case? Why not just calling communicate()? Why not only using stdout directly?Īuthor: Gregory P. When an empty output is retrieved the file object is closed then.įirst time to submit a bug report and pardon me if I am getting anything wrong.Ĭalling municate() after () doesn't seem to be supported. ![]() However, communicate() and the lower API _communicate() use a lower level method os.read() to get the output, which does not respect the underlying buffer. ![]() It stores all output in the buffer when calling read(). ![]() The reason behind this is that Popen.stdout is a BufferedReader. So from the best guess it should be the expected behavior. It works fine on Windows and Python 2.x(communicate() returning the remaining output). Print(p.communicate()) # Returns empty output P = subprocess.Popen("ls -l", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) The following snippet behaves differently between Windows and POSIX. Subprocess: Calling municate() after () returns an empty stringįrost Ming, gregory.p.smith, gstarck, vstinnerĬreated on 08:26 by Frost Ming, last changed 14:59 by admin.
0 Comments
Leave a Reply. |