Hi, 
I'm working with a forked process and I have a problem with:
local SIG{CHLD} = "IGNORE"; to properly kill the forked process when it's
done.

The problem that it works correctly only if I don't use the local() 
keyword, but then I alter the SIG{CHLD} for the whole process' life!  Here
is the example script that works (please no responds saying "it's bad to
fork", the question is about SIG handlers): 

print "Content-type: text/plain\n\n";
$SIG{CHLD} = "IGNORE";
my $cid;
if ($cid = fork) {
  print qq{It might take a while before the process $cid will complete
           the process. When it's done, it will quit cleanly! Bye...};
} else {
  close STDIN;
  close STDOUT;
  close STDERR;
  do_something(1,2,3);
  CORE::exit(0);
}

sub do_something{
  my @args = @_;
}

Now, if I add do:
local $SIG{CHLD} = "IGNORE";

The process becomes a zombie! Which means that the SIG wasn't affected by
my setting.  I have tried to move the setting with local inside the fork -
didn't work either. 

I have tried Doug's Sys::Signal: 

use Sys::Signal ();
Sys::Signal->set(CHLD => sub {"IGNORE"});

didn't help at all :(

What do I miss?

I use:

Apache 1.3.9-dev / mod_perl 1.21_01-dev / perl-5.00503 / RH 6.0

Doug, I've almost solved the problem without Apache::SubProcess, just the
handers thing left!

Thanks!

_______________________________________________________________________
Stas Bekman  mailto:[EMAIL PROTECTED]    www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheaven    http://www.singlesheaven.com

Reply via email to