SPUG:Broken Pipe
Martin, Asa
asa.martin at attws.com
Mon Mar 17 13:11:12 CST 2003
This is sort of a unix question and sort of a perl question, but does anybody know how to get rid of the annoying Broken Pipe message that occurs when I run a system command from within my script and then interrupt the system call in the middle. I'm doing a traceroute and I want to interrupt the trace if it returns "* * *", but when I do that it returns "Broken Pipe".
Code snippet:
open( TRACE, "$TRACE $ip 2>/dev/null |" ) or return;
while (<TRACE>) {
s/\s+//;
if (/^\d+\s+(.*)\s+\((\d+\.\d+\.\d+\.\d+)\)\s+/) {
my $name = $1;
my $ip = $2;
if ( $name eq $ip ) {
push @route, $name;
} else {
push @route, "$name-$ip";
}
}
if (/\*\s+\*\s+/) {
push @route, "*-*-*-*-*";
last;
}
}
close(TRACE);
Anyone have any ideas why Broken Pipe occurs and how to get rid of it? I'm running this on a Solaris machine (2.5.1 OS - please don't ask why). I think it is a OS issue because if I run it on an HP-UX 11.00 machine (again, I won't answer why) there are no Broken Pipe statements.
Ideas?
Asa
More information about the spug-list
mailing list