I have the following perl script (test.pl
):
my $exit_code = system('./test.py');
print $exit_code."\n";
that is trying to capture the exit code from a python executable (test.py
):
#!/bin/env python
import sys
sys.exit(2)
Directly running python executable returns 2, which is what I expected:
> ./test.py
> echo $?
2
However, running perl returns something different:
> perl test.pl
512
Why did perl capture a different exit code from python?