[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [TSVN] Re: Error on nightly build?

From: Nathan Kidd <nathan-svn_at_spicycrypto.ca>
Date: 2004-11-23 17:54:02 CET

Russell Hind wrote:
> I'll have a look tonight, but I've no idea. I have a bat file that
> calls the build.bat of TSVN. If someone knows how to right a .bat
> script that can check a return value from build.bat then possibly but
> otherwise I doubt it.

If you're running (IIRC) NT4+, you can check %ERRORLEVEL%, otherwise (as
others noted) "if errorlevel 1" works.. But this is easily clobbered by
any successful command between when the failure happened and build.bat
returns. We use a system like below (I just typed it, so there may be
typos):

mybuild.cmd:
   set TRY=call try.cmd
   set MASTERERRORLOG=logs\master.log
   set GLOBAL_ERROR_FLAG=

   %TRY% run_important_command.exe
   %TRY% call another_batchfile.bat
   some_command_we_don't_really_care_about.cmd
   %TRY% copy important\files\* dest\

   if defined GLOBAL_ERROR_FLAG (
         die horrible death, do not post build, do not collect $200.
   )

try.cmd:
   %*
   :: add any custom errorlevels you want here
   :: remember "if errorlevel 1" means >= 1, not == 1
   if errorlevel 1 set returncode=1&goto checkerror
   if errorlevel 0 set returncode=0&goto checkerror
   :checkerror
      if "%returncode%"=="0" goto :eof
      set MSG=Error !!! Command returned [%returncode%]: %1 %2 %3 %4 %5
      echo %MSG%
      echo %MSG%>> %MASTERERRORLOG%
      set GLOBAL_ERROR_FLAG=true

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Tue Nov 23 17:54:47 2004

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.