I just played around at the command-line, and both versions set the correct ERRORLEVEL, at least on Windows7 Pro. It may be an issue in the way the .net framework starts processes? I noticed there isn't any special handling for .bat or .cmd files. Actually, which extension is your batch file using .bat or .cmd?
Dave On 28 March 2010 02:06, rdbossjr <[email protected]> wrote: > Craig, > > Thanks for looking at it. I will be looking at the set statements > next week. My question is why would it work fine without the /B but > not work with the /B? > > I'll let you know what I find. > > David > > On Mar 25, 9:41 pm, "Craig Sutherland" <[email protected]> > wrote: > > Hi David, > > > > I've had a quick look into this, and it appears there is something weird > > happening with the batch file execution. Using the following batch file I > > can replicate your issue you mentioned: > > @ECHO OFF > > Whatthe --> This doesn't exist, just need an error level > > SET BUILDFAILED = %ERRORLEVEL% > > ECHO Doing something > > EXIT /B %BUILDFAILED% > > > > With this batch file, CC.NET gets an error code of 0 and thinks > everything > > is ok. > > > > Now, if I remove the spaces from the SET command, it returns the > ERRORLEVEL: > > @ECHO OFF > > Whatthe --> This doesn't exist, just need an error level > > SET BUILDFAILED=%ERRORLEVEL% > > ECHO Doing something > > EXIT /B %BUILDFAILED% > > > > With this version, CC.NET gets the error code (9009) and fails (as > > expected!) > > > > Based on this, I'm guessing you have some spaces in one of your set > > statements which means CMD is not setting the value correctly (??) > > > > Craig-----Original Message----- > > From: [email protected] [mailto:[email protected]] > On > > > > Behalf Of rdbossjr > > Sent: Thursday, 25 March 2010 2:49 a.m. > > To: ccnet-user > > Subject: [ccnet-user] /B on EXIT statement in batch files > > > > Hello, > > > > I have recently added the /B to my EXIT statements in my build batch > files. > > So my Exit statements look like this: > > > > EXIT /B %BUILDFAILED% > > > > where %BUILDFAILED% is set to %ERRORLEVEL% from several process > throughout > > the batch file. > > > > As a result of adding /B my CCNet projects are now green when they should > be > > red. This is the only thing that I changed in the batch files. When I > > remove the /B from the EXIT statements the builds go back to being red. > > > > This is not a show stopper but it is annoying because I now cannot > combine > > these build scripts by calling them from other batch files if I want > those > > batch files to continue after a failure returns from one of the build > > scripts. > > > > Any ideas? > > > > To unsubscribe from this group, send email to > > ccnet-user+unsubscribegooglegroups.com or reply to this email with the > words > > "REMOVE ME" as the subject. > > To unsubscribe from this group, send email to ccnet-user+ > unsubscribegooglegroups.com or reply to this email with the words "REMOVE > ME" as the subject. > To unsubscribe from this group, send email to ccnet-user+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
