I have an Ant build script which currently launches a server and then waits until a URL can be resolved before it carries out some Selenium tests for me. That task looks like this;
<target name="test.selenium" depends="compile.constants, launch.server" description="Run the Selenium tests">
<echodesc/>
<waitfor maxwait="1" maxwaitunit="minute" checkevery="2" checkeveryunit="second">
<http url="http://127.0.0.1:${product.listenport}/"/>
</waitfor>
<exec executable="${deps.python}" spawn="false" failonerror="true" dir="src">
<arg line="manage.py test --selenium-only" />
</exec>
</target>
After that has been successful I want to call a URL which will shutdown the server but I'm unsure of how to do this with Ant. Is it possible to get Ant to call 127.0.0.1:${product.listenport}/QUIT?
I was previously achieving this with a taskkill command to the running process but this has started to cause Windows errors and that URL closes the server cleanly.
The best solution I can find is this macro to open a URL in the browser but this still causes me problems because I then have an open browser at the end of my tests; http://chris.m0nk3y.net/blog/post/opening-a-url-in-the-default-browser-with-ant
my solution
Ultimately I used the following ant target;
<target name="shutdown.server" depends="init.properties" description="Shutdown the server">
<get src="http://127.0.0.1:${product.listenport}/QUIT" dest="NUL"/>
</target>
'NUL' enabled me to use get without dealing with a new file being created so this was perfect for the job \o/