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 <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1241>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to