У меня есть скрипт Perl, который вызывает другой скрипт. Сценарий Perl должен распространять код возврата сценария, но, похоже, возвращает ноль своему вызывающему объекту (приложению Java), несмотря на явный вызов exit $scriptReturnCode
.
Код и вывод следующим образом (я понимаю, что <=>
может/должно быть !=
, но это то, что у меня есть):
print "INFO: Calling ${scriptDirectory}/${script} ${args}"
$scriptReturnCode = system("${scriptDirectory}/${script} ${args}");
if ( $scriptReturnCode <=> 0 ) {
print "ERROR: The script returned $scriptReturnCode\n";
exit $scriptReturnCode;
} else {
print "INFO: The script returned $scriptReturnCode.\n";
exit 0;
}
Вывод, который у меня есть из моей Java:
20/04/2010 14:40:01 - INFO: Calling /path/to/script/script.ksh arg1 arg2
20/04/2010 14:40:01 - Could not find installer files <= this is from the script.ksh
20/04/2010 14:40:01 - ERROR: The script returned 256
20/04/2010 14:40:01 - Command Finished. Exit Code: 0 <= this is the Java app.