On 6/23/05, Stephen Smyth <[EMAIL PROTECTED]> wrote:
> I have a few external programs that have several possible return codes
> each, only 1 of which in each case means failure. However, NAnt itself
> fails if any return code from an exec task is not 0, even if
> failonerror=false for that task (Which in turn causes my cruise control
> server to report a broken build). This is what I'm trying to do:
> 
>         <exec failonerror="false" resultproperty="nunit.exit.code"
> program="nunit-console.exe" basedir="NUnit\bin"
> commandline="bin\Debug\Tests.dll /xml=..\..\NUnit\NUnitConsoleOutput.xml
> /exclude:ExpectedFailure_SqlServer_Standard,ExpectedFailure_All
> /config=bin\Debug\Tests.dll.config" verbose="true"/> <fail
> if="${nunit.exit.code == '2'}">NUnit return code was 2, indicates a
> FAILURE</fail>
> 
> As you cans see I'd prefer to capture the return code myself and fail
> based on that. Is there any way to tell NAnt to ignore return codes
> altogether? And please don't tell me to use a NUnit/NUnit2 task instead;
> there are about 100 reasons why I cant!
> 
> Thanks.

Stephen,

What version of NAnt are you using?  Looking at the source for the
<exec> task, failonerror="false" should definitely stop the build from
failing as far back as 0.84... what error is being reported in the log
in these cases?

One workaround may be to use the <trycatch> task from NAntContrib, but
I'm not sure if you will be able to see what the value of the exit
code is - you may need to test this for suitability.


Also, it would be useful to know at least some of the reasons why the
NUnit/NUnit2 tasks aren't suitable for your build, so they can be
assessed and addressed to make the tasks (more) suitable.

-- 
Troy


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to