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.

3 comments

Hi

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
http://www.nivalonline.com

0

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.

0

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

0

Please sign in to leave a comment.