Issue #21332: Ensure that `bufsize=1` in subprocess.Popen() selects line buffering, rather than block buffering.

This commit is contained in:
Antoine Pitrou 2014-09-21 21:10:56 +02:00
parent 3f40c40dea
commit afe8d0646c
4 changed files with 50 additions and 7 deletions

View file

@ -837,7 +837,8 @@ class Popen(object):
if p2cwrite != -1:
self.stdin = io.open(p2cwrite, 'wb', bufsize)
if universal_newlines:
self.stdin = io.TextIOWrapper(self.stdin, write_through=True)
self.stdin = io.TextIOWrapper(self.stdin, write_through=True,
line_buffering=(bufsize == 1))
if c2pread != -1:
self.stdout = io.open(c2pread, 'rb', bufsize)
if universal_newlines: