On perl v5.8.4 built for MSWin32-x86-multi-thread under cmd.exe (Windows XP SP1a), it looks as though calling.pl gets interrupted and then delivers a SIGINT to called.pl.if( @ARGV ){ $SIG{INT} = \&exit_gracefully; for(1..10){ warn "called sleeping $_"; select undef, undef, undef, 0.5; } exit 1; } else { warn "calling system\n"; system ( $^X, __FILE__ , 'called'); $exit_val = $? >> 8; warn "\n exit_val $exit_val"; } sub exit_gracefully { $SIG{INT} = \&exit_gracefully; print "@ARGV Program interrupted .. \n"; exit (2); } __END__
On perl v5.8.4 built for i386-linux-thread-multi under bash, I get results as expectedC:\>perl \dev\loose\perlfunc.exit.pl calling system called sleeping 1 at \dev\loose\perlfunc.exit.pl line 4. called sleeping 2 at \dev\loose\perlfunc.exit.pl line 4. called sleeping 3 at \dev\loose\perlfunc.exit.pl line 4. called sleeping 4 at \dev\loose\perlfunc.exit.pl line 4. called sleeping 5 at \dev\loose\perlfunc.exit.pl line 4. Terminating on signal SIGINT(2) C:\>called Program interrupted .. C:\>
user@host:~$ perl perlfunc.exit.pl calling system called sleeping 1 at perlfunc.exit.pl line 4. called sleeping 2 at perlfunc.exit.pl line 4. called sleeping 3 at perlfunc.exit.pl line 4. called sleeping 4 at perlfunc.exit.pl line 4. called Program interrupted .. exit_val 2 at perlfunc.exit.pl line 14. user@host:~$ user@host:~$
In reply to Re: exit value not passed back
by PodMaster
in thread exit value not passed back
by mags
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |