You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Yung Choi <ch...@bea.com> on 2004/04/05 23:06:46 UTC

How to exit ant with a background child process running behind?

How can I exit ant with a child process that runs as a background
process?

A simple ant test file antTest.xml like this:

<project name="test" default="test">
<target name="test">
   <exec executable="sh" failonerror="true">
     <arg value="-c"/>
     <arg value="startTest.sh"/>
   </exec>
</target>
</project>

startTest.sh looks (using this with UNIX, make sure chmod +x
startTest.sh):

#! /bin/ksh

date

sleep 60 > /dev/null 2>&1 &

date

exit 0

Then ant -f antTest.xml

This shows different behavior for windows and UNIX (as Solaris):
windows: ant wait for 60 seconds until complete the background child
proces: sleep
UNIX: ant exits right away and the backgrond process keeps running for
60 sec.

The proces on windows is running with MKSNt ksh
and on UNIX as built in ksh. Both with ant 1.6.1.

How can I make this work on the windows the same way as on UNIX?

If possible, I wish a solution with ant version independent.

Any help wouold be appreciated.		- yung

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