You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Z W <mp...@gmail.com> on 2008/01/09 03:03:01 UTC

MS Powershell and Ant and Ping

Hi Gurus

I have a powershell script MyPing.ps1 that pings different hosts.
If any host is down, I would have a return code 2 to indicate ping failure
to all hosts
even though the script works fine and completes execution.
However, I use ANT to execute this script using


<exec dir="." executable="powershell" os="Windows XP" timeout="10000"
failonerror="false"

resultproperty="build_main.debug">

<arg line="./MyPing"/>

</exec>
My understanding is that resultproperty is only set when powershell script
fails, which in this case doesn't fail
since the script completes execution but I like to send a return code to ANT
indicating that even though script
executes to completion, ping still fails since 2 of 10 hosts fails to
respond to ping.

Is there a way for ANT to receive this notification that my ping procedure
fails ?
Or is there a better way to do this ?

Any help is appreciated here.