This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ilgiz
Recipients
Date 2007-06-14.03:15:15
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content

It appears your "yes" does not catch SIGPIPE.  I've reproduced the issue with

$ python -c 'import sys, os; sys.stdout.write(os.popen("while :; do echo yes ; done | echo hello").read())'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
KeyboardInterrupt

The documentation on Python module signal says SIGPIPE is ignored by Python as well.  My work-around to this was to catch SIGPIPE, but the GNU C library would terminate the whole script.

$ python -c 'import sys, os, signal; signal.signal(signal.SIGPIPE, signal.SIG_DFL); sys.stdout.write(os.popen("while :; do echo yes ; done | echo hello").read())'
hello

http://www.gnu.org/software/libc/manual/html_node/Operation-Error-Signals.html

Perhaps, writing own signal handler might help.
History
Date User Action Args
2007-08-23 14:54:59adminlinkissue1736483 messages
2007-08-23 14:54:59admincreate