A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-September/056341.html below:

[Python-Dev] SIGPIPE => SIG_IGN?

[Python-Dev] SIGPIPE => SIG_IGN? [Python-Dev] SIGPIPE => SIG_IGN?Gustavo Niemeyer gustavo at niemeyer.net
Sat Sep 10 01:47:09 CEST 2005
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4