how to detect broken pipe ?
From: funtoosh (a_gilotra_at_yahoo.com)
Date: 12/20/03
- Previous message: Jim Gibson: "Re: counting matched lines in extremely large files."
- Next in thread: Ben Morrow: "Re: how to detect broken pipe ?"
- Reply: Ben Morrow: "Re: how to detect broken pipe ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 19 Dec 2003 22:11:38 -0800
Hi
Scenario:
I have a shell script e.g. a.bash
This script wraps a program called "generate" like this:
generate > /tmp/y.txt 2>&1 # both stdout and stderr r redirected to
y.txt
Now , I have perl script e.g. myPerl.pl and I modify a.bash such that:
generate | perl myPerl.pl # pipe output from "generate" to the perl
script.
And in myPerl.pl, I wrote this :
sub whatSignal { print "caught ",shift, "\n" };
$SIG($_}=\ &whatSignal for keys %SIG
And now I run a.bash in one xterm:
Following happens:
When press ctrl-C, it is caught.
But when I kill pid of program "generate" from a different xterm, my
script doesnt detect "broken pipe" ?
Comments ?
- Previous message: Jim Gibson: "Re: counting matched lines in extremely large files."
- Next in thread: Ben Morrow: "Re: how to detect broken pipe ?"
- Reply: Ben Morrow: "Re: how to detect broken pipe ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|