ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evgeny Goldin <gen...@netvision.net.il>
Subject Re: "If Ant fails, it will return a non-zero exit code" - doesn't hold any more ?
Date Tue, 16 Dec 2003 16:32:56 GMT

That's strange, my previous message doesn't seem to appear on list, so I'll
repeat it here. I think I've found the problem, taking a look on ant.bat:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:runAnt
"%_JAVACMD%" %ANT_OPTS% -classpath "%LOCALCLASSPATH%" "-Dant.home=%ANT_HOME%"
org.apache.tools.ant.Main %ANT_ARGS% %ANT_CMD_LINE_ARGS%
goto end

:runAntWithJikes
"%_JAVACMD%" %ANT_OPTS% -classpath "%LOCALCLASSPATH%" "-Dant.home=%ANT_HOME%"
"-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.Main %ANT_ARGS% %ANT_CMD_LINE_ARGS%
goto end

:end
set LOCALCLASSPATH=
set _JAVACMD=
set ANT_CMD_LINE_ARGS=

if "%OS%"=="Windows_NT" @endlocal

:mainEnd
if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So my thought is following: since running Java isn't the latest operation in
the batch file - all following operations simply overwrite the exit code of java
process which is indeed 1 when it fails. But since following operations do succeed -
what is finally returned to the outside world is *their* exit code, not java's
(never was a batch-files pro, so this is only a guess).

After I removed everything after first "%_JAVACMD%" in :runAnt label (to make sure
"%_JAVACMD%" is the latest operation executed) - the exit code I received from running
'ant' has become 1 for failed projects.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message