ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: do task if condition is value
Date Wed, 17 Jul 2002 09:44:26 GMT
On Wed, 17 Jul 2002, Tibor Strausz <Tibor.Strausz@tridion.com> wrote:

> My problem now is that i want to print the output of the command
> line (which is in a log file) to the screen (prompt) only when there
> is a failer, when 'resultproperty' is 1.  Is there a way to do
> this?? Or should i make a task which looks like:
> 
> <writeLog src="out.log" condition="${resultproperty}" equals="1"/>

You'd run target "run" - replace the <exec> with whatever is
appropriate for you:

<target name="exec-task">
  <exec ... resultproperty="retcode" />
  <condition propery="exec.failed">
    <equals arg1="${retcode}" arg2="1" />
  </condition>
</target>

<target name="run" depends="exec-task" if="exec.failed">
  <concat>
    <filelist dir="." files="out.log" />
  </concat>
</target>

Stefan

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message