execute shell command pipeline

Jeff Epler jepler at unpythonic.net
Thu Mar 25 21:44:05 CET 2004


The Python library manual says (http://python.org/doc/lib/module-signal.html)
    Python installs a small number of signal handlers by default: SIGPIPE
    is ignored (so write errors on pipes and sockets can be reported as
    ordinary Python exceptions) and SIGINT is translated into a
    KeyboardInterrupt exception. All of these can be overridden.
In perl, or from the shell, grep is terminated by SIGPIPE.  In Python,
grep ignores the signal because the "ignored" status of SIGPIPE is
inherited by the child process.  Instead, it prints the error once for
each write that returns -EPIPE.

Jeff




More information about the Python-list mailing list