zgrep: terminate gracefully when a pipeline is interrupted by a signal
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 30 Jan 2010 22:36:35 +0000 (22:36 +0000)
committerJim Meyering <meyering@redhat.com>
Thu, 4 Feb 2010 06:16:11 +0000 (07:16 +0100)
commitfc00329e3dc13932b0ab80cc15fa8e7ecde064cf
tree3aaf7e296b228e59b0984442bf1fdc80862a4141
parentec347e5ed8daee2fe0c34a23fb13633918e99503
zgrep: terminate gracefully when a pipeline is interrupted by a signal

zgrep is not terminated gracefully when its grep/sed pipeline
is terminated by a signal.  For example, a command like
zgrep -F .TH /usr/share/man/man1/*.gz | head
continues working long after the "head" process completes.
Another example, a command like
zgrep unmatched-pattern /usr/share/man/man1/*.gz
cannot be interrupted by sending a SIGQUIT with Ctrl-\ key, it outputs
zgrep: line 221: test: : integer expression expected
and goes on.
* zgrep.in: Terminate gracefully when the grep/sed pipeline is
terminated by a signal.
* tests/zgrep-signal: New test.
* Makefile.am (TESTS): Add it.
Makefile.am
tests/zgrep-signal [new file with mode: 0644]
zgrep.in