system returns the exit code of the executed system call. Since your system call is returning -1, a truth value, your code thinks everything went ok. Believe it or not, the only way your program would die is if the call executed properly and the called program exited with a 0 status (since default successful exit status is 0). Something like the following would probably be what you want:
system("/msg/spgear/tools/bin/perl $1"); die "Could not run program: $1 -- $!$/" if $? == -1;
That aside, you need to REALLY reconsider your regex pulling out your execute call. Someone could quite easily pass "EXECUTE:-e'0';rm -rf /" to your program. See the problem?
Hope this helps.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
In reply to Re: Wrong return code after a system call
by antirice
in thread Wrong return code after a system call
by TASdvlper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |