develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [Fwd: [ID 20000318.005] Linix, Open2() and DEFUNCT processes.]

Thread Previous
From:
Daniel L. Needles
Date:
March 18, 2000 21:41
Subject:
Re: [Fwd: [ID 20000318.005] Linix, Open2() and DEFUNCT processes.]
Message ID:
38D46866.E1F4DC4D@ins.com
Russ,
  Thanks!  That was it!  Adding waitpid($f, 0); after the last close did the trick!

Thanks,
Daniel L. Needles

"Daniel L. Needles" wrote:

>   ------------------------------------------------------------------------
>
> Subject: Re: [ID 20000318.005] Linix, Open2() and DEFUNCT processes.
> Date: Sat, 18 Mar 2000 21:00:26 -0800
> From: "Daniel L. Needles" <Dan_Needles@ins.com>
> Organization: International Network Services
> To: Tom Christiansen <tchrist@chthon.perl.com>
> References: <25181.953439599@chthon>
>
> Tom Christiansen wrote:
>
> > Did you close the file handles?
> >
>
> Yes
>
> > Did you wait on your forked children?
> >
>
> Not sure.  Could you check the 20 line program that follows:
>
> #!/opt/CAV1perl/bin/perl
> ################################################################################
>
> # PROGRAM: OPEN2TEST          Version 1.0             Daniel L.
> Needles        #
> ################################################################################
>
> # LOAD MODULES
> use FileHandle; # For Open2 (Default PERL has no bidirectional pipes.)
> use IPC::Open2; # For Open2 (Default PERL has no bidirectional pipes.)
>
> # PREPARE ENVIRONMENT
> my $ip, $ms, $icmptype, $icmpcode, $responder, $junk;
> my ($FIN, $FOUT) = (FileHandle->new, FileHandle->new);
> open(DEBUG, '> async.out') or die "ASYNC: E: Could not open debug
> file.\n";
>
> while ( 1 ) {
>   $fping = open2( $FOUT, $FIN, "./f -e" ) || die "ASYNC: Could not open
> bidirect
> ional pipe.";
>
> # INPUT DATA
>   $wtcnt=0;
>   print $FIN "127.0.0.1\n";
>   print $FIN "127.0.0.1\n";
>   print $FIN "127.0.0.1\n";
> # SIGNAL TIME FOR OUTPUT
>   print $FIN "-\n";
>   close($FIN);
>
> # RECEIVE DATA
>   while ( $data = <$FOUT> ) {
>     if ($data ne "" ) {
>       ( $ip, $ms, $icmptype, $icmpcode, $responder, $junk ) = split
> /,/,$data,6;
>       chomp($responder);
>
>     }
>   }
>   close($FOUT);
>   sleep 60;
> }
>
> >
> > --tom


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About