Bugs item #3080640, was opened at 2010-10-03 18:07
Message generated for change (Tracker Item Submitted) made by wshipley
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=3080640&group_id=31650

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tasks
Group: 0.91-alpha2
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: William Shipley (wshipley)
Assigned to: Nobody/Anonymous (nobody)
Summary: <exec> Task Always Returns 0 for Batch Files on Windows XP

Initial Comment:
I\\\'m encountering an issue with the <exec>  task on batch files in my NAnt 
project files.  When running on Windows XP SP 3 (but not Windows Vista or 
Windows Server 2008) and using NAnt 0.85 or 0.91alpha2, the <exec> task will 
always succeed (returning an error code of 0) regardless of what the executed 
batch file returned.

As an example, I wrote the following NAnt target:

    <target name=\\\"build\\\">
        <exec program=\\\"fail.bat\\\"
            failonerror=\\\"false\\\" resultproperty=\\\"makeall.result\\\">
        </exec>
        <echo message=\\\"Makeall task returned result ${makeall.result}\\\"/>
        <fail if=\\\"${int::parse(makeall.result) != 0}\\\">Encountered 
${makeall.result} errors.</fail>
    </target>

which calls the following batch file:

    exit /b 1

Under normal operation (Windows Vista), the result of running NAnt is:

    build:

         [exec] C:\\\\Users\\\\Will\\\\Code>exit /b 1 
         [exec] C:\\\\Users\\\\Will\\\\Code\\\\fail.build(6,4):
         [exec] External Program Failed: 
C:\\\\Users\\\\Will\\\\Code\\\\fail.bat (return code was 1)
         [echo] Makeall task returned result 1

    BUILD FAILED - 1 non-fatal error(s), 0 warning(s)

But on two different Windows XP SP3 machines, the result of running NAnt is:

    build:

         [exec] C:\\\\Documents and Settings\\\\Will\\\\My Documents\\\\My 
Code>exit /b 1 
         [echo] Makeall task returned result 0

    BUILD SUCCEEDED

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=3080640&group_id=31650

------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to