Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
2.2.2, 2.3.3
-
None
-
None
Description
I'm using Groovy 2.3.3 and would like to automate some groovysh script
testing. I noticed that when using Groovy shell in non-interactive mode,
the returned status code of 'groovysh' is always 0 (meaning success)
even if the command failed. As an example:
ksc@ksc-desktop:~$ groovysh ":load non-existent-file.groovy"
File not found: non-existent-file.groovy
ksc@ksc-desktop:~$ echo $?
0
I would expect groovysh to return a non-zero value if there was any
error during execution. It already works if there is an un-caught exception:
ksc@ksc-desktop:~$ groovysh "throw new RuntimeException()"
FATAL: java.lang.RuntimeException
...
ksc@ksc-desktop:~$ echo $?
1