ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 4345] New: - Request for addition of "rcproperty" attribute to <exec>
Date Mon, 22 Oct 2001 19:11:28 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4345>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4345

Request for addition of "rcproperty" attribute to <exec>

           Summary: Request for addition of "rcproperty" attribute to <exec>
           Product: Ant
           Version: unspecified
          Platform: Other
               URL: http://marc.theaimsgroup.com/?l=ant-
                    user&m=100352348524222&w=2
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: gjfdh@yahoo.com


From:     Yyy Xxx <gjfdh@yahoo.com>
Date:     2001-10-19 17:48:24

Thank you, Phil, for your outputproperty example.  But I'm actually looking for 
an "rcproperty" attribute.  I'd like to have the return code of the exec made 
visible to ant.

For instance, suppose I exec a program and want to take action if the program 
fails.  I could use the failonerror attribute and have the ant build fail.  But 
it would be better if I could fail more gracefully.

Here's a made-up example.  The Unix diff program exits with a status(return) 
code of 0 if two files are the same, 1 if some differences were found, and 2 
means trouble.

The "diff" target causes diff to be run against two files.  The (made up) 
rcproperty attribute would capture the status code and let <condition> analyze
it. When diff returned a status code of "2", ant would automatically e-mail me 
a note before failing.

<target name='rundiff'>
  <exec executable='diff' rcproperty='diff.rc'>
     <arg value='${file1}'/>
     <arg value='${file2}'/>
  </exec>

  <condition property='diff.failed'>
    <equals arg1='${diff.rc}' arg2='2'/>
  </condition>
</target>

<target name='check-diff' depends='rundiff'
if='diff.failed'>
  <mail subject='*** DIFF Failed ***' message='A diff
of ${file1} and ${file2} is giving us trouble.'/>
  <fail/>
</target>

<target name="diff" depends='check-diff'/>

Mime
View raw message