different errorlevel in teamcity and command line

We use build runner which executes a bat file as a "simple command execution". When executed from teamcity, the build never fails and there is "Process exit code: 0" in teamcity's output log. However, if executed from the command line, the same bat file set %ERRORLEVEL% to 1.

Comment actions Permalink


We use many cmd builders and everything works fine.

Try to write bat file like this.

CALL MainBuildProcess.exe
@if %errorlevel% NEQ 0 EXIT 1

Best regards,

Alexander Shishenin
QA Lead at Client Team
Moscow Development Studio
Nival Online

Comment actions Permalink

Thanks for advice. I beleive the problem is not with Teamcity, but with bat file. The bat file goes like this:
@echo off
%ANT_HOME%\bin\ant -quiet %1 %2 %3 %4 %5
echo "this line is never executed"

So I cannot add something at the end.

Comment actions Permalink

Adding "exit %ERRORLEVEL%" at the end of ant.bat seems to have solved the problem.


Please sign in to leave a comment.