Set failonerror to false on the <exec> task and use the resultproperty attribute to capture the return code. After the task has completed, you can use the <if> task to check the resultproperty and process it accordingly.
 
-Mike


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul
Sent: Wednesday, February 15, 2006 12:45 PM
To: [email protected]
Subject: [NAnt-users] Return code on exec task

Hi,  I’ve got a question about the <exec> task – basically, I need the return code that the program returns.

 

I’m running robocopy.exe externally to copy files using the exec task.  Unfortunately, robocopy returns a code of 1 on success.  I’d like to continue running the nant script on return code of 1 (and possibly some other return codes) and fail otherwise. 

 

Using failonerror=false won’t allow me to fail on real errors. 

 

Is there a way to store the return code in a property in the nant script?

 

Thanks in advance for any insight.

 

Paul

_________________________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

Espanol - Deutsch - Nederlands - Francais - Italiano - Norsk - Svenska: www.cardinalhealth.com/legal/email

Reply via email to