$rslt = $? >> 8;
Then Windows app (command line) can exit with any value (can see using %ERRORLEVEL%).
Is is fair to expect a correct error code post $? >> 8 on Windows?
The answer doesn't seem to agree because Perl's system() API uses one byte to hold the exit status.
My application exits with error codes greater than 255. I have used the following hack to get correct error code on windows
$expected_err_code = 501;
$modified_expected_err_code = 501 % 256; // re-map to: - 0 - 255
$rslt = $? >> 8;
if( $rslt == $modified_expected_err_code ) {
print "Its OK";
}
It looks like the perl module IPC::System::Simple supports 32 bit exit status.