Hi,

I have an issue when using fork and sig in the same process. You will find
below an example of what is my problem.

When you run the script whit the fork, the INT signal generated by
"Control-C" is not handled by the process?


If you comment the "$pseudoId=fork()" and uncomment the line "$pseudoId=0",
the INT signal is correctly managed.

I guess I am missing something when using both fork and sig.

Any ideas?

I am using ActivePerl v5.8.0

Regards,

Serge

---------------


use strict;
use warnings;

$|=1;


$SIG{'INT'}=\&killHandler;

my $pseudoId;

$pseudoId=fork();
#$pseudoId=0;

if ($pseudoId == 0)
  {
    print "I am Child\n";
    print "Child Looping\n";
    while (1) {}
  }
else
  {
    print "I am Father\n";
    waitpid ($pseudoId,0);
    print "Father Leaving\n";
  }
print "Done\n";

sub killHandler
  {
    my ($sig) = @_;
    print "Got Signal $sig\n";
    exit;
  }




-------------



Serge Andouche

Tel: + 33 (0) 1 44 93 24 24
Fax: + 33 (0) 1 44 93 24 25

MCC Software
35 Rue Chanzy
75 011 PARIS - FRANCE



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to