Greetings,
I was wondering, why are we setting SIGPIPE to SIG_IGN
in initsigs():
static void
initsigs(void)
{
#ifdef SIGPIPE
PyOS_setsig(SIGPIPE, SIG_IGN);
#endif
[...]
}
One of the side effects is:
>>> os.system("yes | read any")
yes: standard output: Broken pipe
yes: write error
0
>>> os.system("yes | head -1")
y
yes: standard output: Broken pipe
yes: write error
0
That stops when setting to SIG_DFL:
>>> signal.signal(signal.SIGPIPE, signal.SIG_DFL)
1
>>> os.system("yes | head -1")
y
0
>>> os.system("yes | read any")
0
Out of curiosity, many of the google results for
"yes: standard output: Broken pipe" are from
Python programs. :-)
Regards,
--
Gustavo Niemeyer
http://niemeyer.net
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com