Re: How to get bash to shut up about SIGPIPE?
From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:41:56
On Tue, 3 May 2005, David A. Wheeler wrote:
I wonder, does a top-level trap work? E.g.: trap "" SIGPIPE
No. But putting the traps _inside_ the loops seems to help. So something like the appended at least makes it somewhat useful And yes, you need them at both levels, it appears. Or maybe that just changes the timing enough. Whatever. Linus ---- Index: cg-log ===================================================================
--- aa6233be6d1b8bf42797c409a7c23b50593afc99/cg-log (mode:100755 sha1:aa2abf370753117a350818dbc91991b14d30ec6b)
+++ uncommitted/cg-log (mode:100755)@@ -47,10 +47,12 @@ fi $revls | $revsort | while read time commit parents; do + trap "exit 1" SIGPIPE [ "$revfmt" = "git-rev-list" ] && commit="$time" echo $colheader""commit ${commit%:*} $coldefault; git-cat-file commit $commit | \ while read key rest; do + trap "exit 1" SIGPIPE case "$key" in "author"|"committer") if [ "$key" = "author" ]; then