I have a Perl script that calls another script. A perl script should distribute the script return code, but it seems to return a null value to its caller (Java application) desipte by explicitly calling exit $scriptReturnCode .
The code and output are as follows (I understand that <=> may / should be != , But what I have):
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; }
Exit from my 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.
perl return-value
Tom ducking
source share