tee like program to pipe to another program?

Tom Christiansen tchrist at convex.COM
Fri Jun 7 04:49:27 AEST 1991


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 at convex.com	convex!tchrist
	    "Perl is to sed as C is to assembly language."  -me



More information about the Alt.sources.patches mailing list