K
kaleem
Hello,
I'm calling 'exit 1' inside a Perl script. When the script terminates
and I check the exit status using 'echo $?', I get 0! Can someone
explain what exactly is happening here and whether it's a Perl bug. The
details follow:
Platform: Linx 2.6 on IA64
Here's the script (read between the lines ):
----------------------------------------------------------------
#!/usr/bin/perl -w
BEGIN {
push(@INC, "/diag-tools/mmii-diags/perlmod"); # The path where
Expect.pm module is located
}
use Expect;
our $exp;
$exp = new Expect;
$exp->raw_pty(0);
our $debug_mode = 1;
$exp->log_stdout($debug_mode);
$exp->spawn("ksh");
#$exp->hard_close();
exit 1;
---------------------------------------------------------------------
If I comment '$exp->hard_close()', the status returned is 0! If I
uncomment '$exp->harc_close()', the status returned is 1. I check
return status using 'echo $?'
So what seems to be happening is that if I don't close the command
spawned by Expect, someone is changing $? to 0 and that's how my return
status becomes 0.
Can you tell me who exaclty is doing this and why?
I'm calling 'exit 1' inside a Perl script. When the script terminates
and I check the exit status using 'echo $?', I get 0! Can someone
explain what exactly is happening here and whether it's a Perl bug. The
details follow:
Platform: Linx 2.6 on IA64
Here's the script (read between the lines ):
----------------------------------------------------------------
#!/usr/bin/perl -w
BEGIN {
push(@INC, "/diag-tools/mmii-diags/perlmod"); # The path where
Expect.pm module is located
}
use Expect;
our $exp;
$exp = new Expect;
$exp->raw_pty(0);
our $debug_mode = 1;
$exp->log_stdout($debug_mode);
$exp->spawn("ksh");
#$exp->hard_close();
exit 1;
---------------------------------------------------------------------
If I comment '$exp->hard_close()', the status returned is 0! If I
uncomment '$exp->harc_close()', the status returned is 1. I check
return status using 'echo $?'
So what seems to be happening is that if I don't close the command
spawned by Expect, someone is changing $? to 0 and that's how my return
status becomes 0.
Can you tell me who exaclty is doing this and why?