ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donal Quinlan <do...@savvion.com>
Subject Re: exit code
Date Tue, 15 Apr 2003 20:46:34 GMT
I want to avoid using <exec> because of all the os issues it will cause.
However I successfully grafted the resultproperty code from 
ExecTask.java and put it into a custom java task (which was a copy of 
Java.java). This worked like a dream.

    <taskdef name="resultjava"
             classname="com.savvion.tools.ant.taskdefs.ResultJava"/>
....
      <resultjava classname="com.installshield.isje.ISJE" fork="true" 
failonerror="false"
            resultproperty="exitcode"
            dir="${mp50.dir}" jvm="${mp50.jvm}">
....

      <condition property="good.installer.build">
        <or>
          <equals arg1="${exitcode}" arg2="0" />
          <equals arg1="${exitcode}" arg2="-1" />
        </or>
      </condition>
      <fail unless="${good.installer.build}"
            message="More than just warnings occurred when building 
MultiPlatform installer, exitcode = ${exitcode}"/>

This was so simple to add, I think it should be made part of the normal 
<java> task. I would be willing to do it (because it's simple :-)  )

Alternatively I can email the custom class if somebody else would find 
it useful.

Thanks

Donal

PS. Like the book Steve (and Erik). It has been a life saver on more 
than one occassion. Now would that be you or Erik posing on the cover? ;-)

Steve Loughran wrote:

> Donal Quinlan wrote:
>
>> We have had failonerror set to false for a long time. What we want to 
>> do now is make the build fail if the exit code is anything other than 
>> 0 or -1. Any ideas? I know how to do this if I can capture the exit 
>> code, but I do not know how to capture the exit code. We are using 
>> ant 1.5.2
>
>
> There is some attribute of <exec> that lets you name a property to 
> stick the exit code in, your test is simply a <condition> and then a 
> <fail> from that...
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>



Mime
View raw message