Chapter_01 has asked for the wisdom of the Perl Monks concerning the following question:
This works in the sence that when I copy/print/echo a string to the pipe (/opt/WFmon/logs/cpu.comm), the script proceeds to the first "if" statement. Otherwise, the script just hangs there waiting for the pipe to complete and never times out.#!/usr/bin/perl -w use strict; my $FiFo='/opt/WFmon/logs/cpu.comm'; my $read=''; my $timeout=1; my ($nfound); open(FIFO, "<$FiFo") || warn "cannot open fifo\n"; vec($read, fileno(FIFO), 1) = 1; $nfound = select($read, undef, undef, $timeout); if($nfound){ if(vec($read, fileno(FIFO), 1)){ print "here - $nfound\n"; } else{ print "not here - $nfound\n"; } } else{ print "nothing\n"; } close(FIFO);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: timeout on dead pipe
by Thelonius (Priest) on Feb 27, 2003 at 02:54 UTC | |
by Chapter_01 (Initiate) on Feb 27, 2003 at 03:32 UTC |