My Perl script looks like this
A.pl
#!/usr/bin/perl
system("perl ctrlc.pl");
ctrlc.pl
sub signal_handler {
print "Niraj";
}
$SIG{INT} = \&signal_handler;
print "Enter number";
my $no1 = <>;
When I run perl A.pl
and press Ctrl-C it is detecting and printing "Niraj".
But when I run setsid perl A.pl
, it is not detecting Ctrl-C.