[issue1241] subprocess.py stdout of childprocess always buffered.
Peter Ã…strand
report at bugs.python.org
Sat Oct 6 09:05:00 CEST 2007
Peter Ã…strand added the comment:
Most probably, this is not a problem with the Python side or the pipes,
but the libc streams in the application. stderr is normally unbuffered,
while stdout is buffered. You can see this by running the app with grep:
$ ./a.out | grep STDOUT
STDERR sleeping 0
STDERR sleeping 1
STDERR sleeping 2
STDERR sleeping 3
If you throw in a:
setvbuf(stdout, NULL, _IONBF, 0);
things will work the way you expect:
$ ./a.out | grep STDOUT
STDERR sleeping 0
STDOUT boo 0
STDOUT sleeping 0
STDERR sleeping 1
STDOUT boo 1
----------
nosy: +astrand
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1241>
__________________________________
More information about the Python-bugs-list
mailing list