ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Layman <>
Subject RE: Possible bug with failonerror attribute of exec task
Date Thu, 01 Feb 2001 16:29:45 GMT

	Do batch files exit with an error code that is the same as
errorlevel?  You might want to check this using something like
getRuntime().exec and checking the int returned.  I thought that the batch
files had to call exit x to make them return a paticular exit code (which is
all that Java knows about, it doesn't see any environment variables)


-----Original Message-----
From: Michaël Smith []
Sent: Thursday, February 01, 2001 11:55 AM
Subject: Re: Possible bug with failonerror attribute of exec task

I'm now sure this is a bug.  When I exec a java class it works as expected 
(detects the error level and the build fails).  When I execute a batch file,

which in turn executes the java class, even though the batch file prints a 
non-zero error level, the build still succeeds.  So the bug is this:

failonerror does not work when executing a batch file (on windows 2000).


>I believe I have found a bug with the failonerror attribute of the exec
>task.  Here is part of my build.xml:
>   <target name="test">
>        <echo message=""/>
>        <echo message="-- Building and executing tests:"/>
>        <echo message=""/>
>        <exec dir="../../../${project.vob}/${}/build"
>executable="test.bat" os="Windows 2000" failonerror="True"/>
>    </target>
>For the failonerror I tried "true" "True" "yes" "Yes".  I'm not sure which
>is correct because it's not documented.  Here is my batch file:
>dir asdf
>echo errorlevel = %ERRORLEVEL%
>This always has errorlevel = 1.
>Finally the output of my build:
>Ant version 1.2 compiled on October 24 2000
>Buildfile: build.xml
>Detected Java Version: 1.3
>Detected OS: Windows 2000
>Project base dir set to: Z:\Common\catapult\bin
>Build sequence for target `test' is [test]
>Complete build sequence is [test, init, shutdown_test_environment, tests,
>build_tar, deploy_tar, init_test_environment, clean, usage, label, build]
>-- Building and executing tests:
>     [exec] Myos = Windows 2000
>     [exec] test.bat
>     [exec]
>     [exec] Fichier introuvable
>     [exec] Z:\customer_registry\customer\build>dir asdf
>     [exec]  Le volume dans le lecteur Z s'appelle CCase
>     [exec]  Le num&#8218;ro de s&#8218;rie du volume est 0234-5789
>     [exec]
>     [exec]  R&#8218;pertoire de Z:\customer_registry\customer\build
>     [exec]
>     [exec]
>     [exec] Z:\customer_registry\customer\build>echo errorlevel = 1
>     [exec] errorlevel = 1
>Total time: 1 second
>Get Your Private, Free E-mail from MSN Hotmail at

Get Your Private, Free E-mail from MSN Hotmail at

View raw message