|
|
|
[
Permlink
| « Hide
]
Jochen Theodorou - 01/Sep/05 11:26 AM
can you please test "exit /b %ERROR_LEVEL%" ?
I already did, I just forgot to include a comment about that in the bug report. Sorry.
It does not work, either. I also tried both spellings ERROR_LEVEL and ERRORLEVEL. The first should be correct (as it works when using exit %ERROR_LEVEL%), but the latter form appears in the documentation you get by typing I inspected other Java apps that start via .bat files and noticed that at least ajc (the aspectj compiler, www.eclipse.org/aspectj) does manage to return the correct exit code:
C:\Temp>groovy -e "def p='ajc.bat'.execute();def t=p.err.text;p.waitFor();println p.exitValue()" // had to read the messages in the err stream, otherwise p.waitFor() does not return I looked at ajc.bat and noticed that running the Java class is on the last line. I experimented a little and noticed this also works w/ groovy.bat. This is quite fragile - the lines after running the Java class may contain only whitespace - not even comments. To emphasize: the return code is correct if the last line of the groovy.bat is I hope this is of some help. Is it still the case that the return value is not correct?
Yes, the return value is still always 0. I think the importance of this is now quite small as the native launcher behaves correctly and is included in the windows installer (which I would believe most windows users will use).
A weird thing though is that groovy -e "p='groovy.bat -e \"System.exit(1)\"'.execute();p.waitFor();println p.exitValue()" does not work any more. It prints "255", but it seems that the problem is that groovy.bat (that is invoked in the one-liner) is not executed at all for some reason. The ruby version of the test works fine: C:\Documents and Settings\nak>ruby -e "system('groovy.bat -e \"System.exit(1)\"');print $?>>8" |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||