Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-JSR-3
-
Fix Version/s: 1.7.2, 1.6.9, 1.8-beta-1
-
Component/s: None
-
Labels:None
-
Environment:win xp sp2, java 1.4.2_09
-
Testcase included:yes
-
Number of attachments :
Description
Running groovy from within another script does not give the real exit value of the groovy process. Try any of the following:
perl -e "system('groovy -e \"System.exit(1)\"');print $?>>8"
ruby -e "system('groovy.bat -e \"System.exit(1)\"');print $?>>8"
groovy -e "p='groovy.bat -e \"System.exit(1)\"'.execute();p.waitFor();println p.exitValue()"
To see that the above examples are correct in catching the exit code, try e.g.
ruby -e "system('ruby -e \"exit(2)\"');print $?>>8"
groovy -e "def p='ruby -e \"exit(2)\"'.execute();;p.waitFor();println p.exitValue()"
Adding
exit %ERROR_LEVEL%
to the end of groovy.bat solves the problem but is not usable as it causes command prompt to exit if running groovy directly (i.e. not via some other script).
can you please test "exit /b %ERROR_LEVEL%" ?