M
Mags
Dear All,
I have a strange problem I am calling a perl script from another perl script
using the system command.
The called perl script can exit with different values which I want to
capture in the calling script. This works fine unless the called script is
interrupted by ctrl-c (although I have accounted for this), instead of
getting -2 (as below) I get 1 returned??
Any advice much appreciated.
Maged
Here is sample of my code:
calling.pl
#######
eval { system ("called.pl"); };
$exit_val = $? >> 8;
called.pl
#######
$SIG{INT} = \&exit_gracefully;
main block ...
$exit_value = 0;
exit $exit_value;
sub exit_gracefully
{
$SIG{INT} = \&exit_gracefully;
print "Program interrupted .. \n";
exit (-2);
}
I have a strange problem I am calling a perl script from another perl script
using the system command.
The called perl script can exit with different values which I want to
capture in the calling script. This works fine unless the called script is
interrupted by ctrl-c (although I have accounted for this), instead of
getting -2 (as below) I get 1 returned??
Any advice much appreciated.
Maged
Here is sample of my code:
calling.pl
#######
eval { system ("called.pl"); };
$exit_val = $? >> 8;
called.pl
#######
$SIG{INT} = \&exit_gracefully;
main block ...
$exit_value = 0;
exit $exit_value;
sub exit_gracefully
{
$SIG{INT} = \&exit_gracefully;
print "Program interrupted .. \n";
exit (-2);
}