How about closing it after you have reaped the child?
local $SIG{CHLD}= sub {my $child=wait ; close PROG or log_message("close
failed for program and $child $!");};
you'll need to check in your docs for the appropriate way to reap on your
system.
cliff rayman
genwax.com
Bill Moseley wrote:
> If running a program with a fork/exec within a mod_perl handler (not the
> best thing to do in mod_perl) with the following code:
>
> my $pid = open( PROG, "-|" );
>
> if ($pid) {
> while (<PROG>) {
> [..]
> }
> close( PROG ) or log_message( "failed close on program $! $?");
>
> What's the proper way to close/kill PROG _early_ before PROG has finished
> with it's output. I keep getting SIGPIPE errors ($? = 13) returned if I
> close before PROG is finished.
>
> I could kill( 'HUP', $pid ), instead of calling close() but then would I
> leak file handles? Calling kill doesn't seem like a the best solution.
>
> Thanks,
>
> Bill Moseley
> mailto:[EMAIL PROTECTED]