ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: How to capture [exec]
Date Wed, 09 Jan 2008 13:48:38 GMT
Z W wrote:
> Hi
> 
> I have a Powershell script that contains the line "exit 2" when ping fails
> From Ant, it's showing
> 
> _ping:
>      [echo]  Inside _build_ping_alive module
>      [exec] Pinging host1 ...
>      [exec] success
>      [exec] Pinging host2 ...
>      [exec] error: 11010 occurred
>      [exec] LastExitCode: 0
>      [exec] error.count: 0
>      [exec] *Result: 1*
> How to I capture the 1 with Ant ?
> In Ant, I have
> 


> <exec dir="." executable="powershell" os="Windows XP" timeout="10000"
> failonerror="false"
> 
> resultproperty="build_main.debug">
> 
> <arg line="./MyPing host2"/>
> 
> </exec>

by setting failonerror="false" you've told ant you want the result to 
passed back in the result property. Isnt that what youare seeing?

incidentally, ping/ICMP is a very low-level liveness test; machines can 
respond to ping and still not be functional. I normally check for a well 
known port (such as 22 for ssh), which tells me that the machine has 
booted up to a reasonable state from which you can do more useful things

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

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


Mime
View raw message