[alt.sources.patches] tee like program to pipe to another program?

tchrist@convex.COM (Tom Christiansen) (06/07/91)

It might be nice to get better than an ungraceful death by
SIGPIPE if a pipe kid dies or never gets started.  Here's
a patch to trap this:

16a17
> $SIG{'PIPE'} = 'PLUMBER';
37c38
<     close($fh) && next;
---
>     next if close($fh) || !defined $fh{$fh};
41a43,48
>
> sub PLUMBER {
>     warn "$0: pipe to \"$fh{$fh}\" broke!\n";
>     $status++;
>     delete $fh{$fh};
> }


--tom
--
Tom Christiansen		tchrist@convex.com	convex!tchrist
	    "Perl is to sed as C is to assembly language."  -me