DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=41039>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=41039 Summary: ant.bat exit strategy improvements and issues Product: Ant Version: 1.7.0RC1 Platform: Other OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: Core AssignedTo: dev@ant.apache.org ReportedBy: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] The exit/errorlevel logic seems weird, maybe there are some other environments that I am unaware of, but with 4NT and MKS the following issues appear: 1. Under MKS there is a color.exe command that does not properly return 0 when bg and fg colours are set. So if the build fails under MKS you black. :-) 2. Under 4NT the command "echo 1 > nul | choice /n /c:1" only applies the echo to the if the choice after the pipe gets executed. In the current logic, both of the following ifs will just return 1 rem Set the return code if we are not in NT. We can only set rem a value of 1, but it's better than nothing. if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1 rem Set the ERRORLEVEL if we are running NT. if "%OS%"=="Windows_NT" color 00 I have rem'd out the two above ifs and replaced them with set ANT_ERROR=1 Then at the bottom of the script just do: exit /b %ANT_ERROR% I have done some testing: Consider the following ANT script (build.xml) fragment: <target name="pass"> <echo>Pass</echo> </target> <target name="fail"> <fail>Fail</fail> </target> and the batch file b.bat: > cat b.bat call ant %1 echo errorlevel = %errorlevel% the output under cmd.exe is: [w:\eas-6.1\dotnet\calc] [jagmain_delafran_vu] > cmd Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. [W:\eas-6.1\dotNet\calc] [jagmain_delafran_vu] > ver Microsoft Windows XP [Version 5.1.2600] [W:\eas-6.1\dotNet\calc] [jagmain_delafran_vu] > b pass [W:\eas-6.1\dotNet\calc] [jagmain_delafran_vu] > call ant pass Buildfile: build.xml pass: [echo] Pass BUILD SUCCESSFUL Total time: 0 seconds errorlevel = 0 [W:\eas-6.1\dotNet\calc] [jagmain_delafran_vu] > b fail [W:\eas-6.1\dotNet\calc] [jagmain_delafran_vu] > call ant fail Buildfile: build.xml fail: BUILD FAILED W:\eas-6.1\dotNet\calc\build.xml:33: Fail Total time: 0 seconds errorlevel = 1 [W:\eas-6.1\dotNet\calc] [jagmain_delafran_vu] > The output under 4NT.exe is: [w:\eas-6.1\dotnet\calc] [jagmain_delafran_vu] > ver 4NT 8.00.49 Windows XP [Version 5.1.2600] [w:\eas-6.1\dotnet\calc] [jagmain_delafran_vu] > b pass Buildfile: build.xml pass: [echo] Pass BUILD SUCCESSFUL Total time: 0 seconds errorlevel = 0 [w:\eas-6.1\dotnet\calc] [jagmain_delafran_vu] > b fail Buildfile: build.xml fail: BUILD FAILED W:\eas-6.1\dotNet\calc\build.xml:33: Fail Total time: 0 seconds errorlevel = 1 [w:\eas-6.1\dotnet\calc] [jagmain_delafran_vu] > So, the caller b.bat will properly get the return code (errorlevel) from the ant.bat file. I expect that any process the launches ant.bat will also get the proper return value. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]