Charles-Francois Natali <neolo...@free.fr> added the comment:

This is normal behaviour: stdout is normally line buffered (_IOLBF) only if 
connected to a tty.
When it's not connected to a tty, it's full buffered (_IOFBF). This is done on 
purpose for performance reason. To convince yourself, run 

$ cat test.py
for i in range(1, 1000000):
    print('hello world')

$ time python test.py > /tmp/foo

With buffering off (-u option), the same commande takes almost 10 times longer.

If the application wants to be sure to receive a SIGPIPE when the pipe's end is 
closed, it should just flush stdout explicitely (sys.stdout.flush()).

Suggesting to close.

----------
nosy: +neologix, pitrou

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

Reply via email to