You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Anderson, Kajsa" <Ka...@thomson.com> on 2004/04/05 23:11:26 UTC

RE: How to exit ant with a background child process running behin d?

http://ant.apache.org/manual/CoreTasks/exec.html
See the doc on the "spawn" attribute of <exec> (Ant 1.6+)

This seems to be asked quite often - is it the sort of thing that might
belong in the FAQ?

Kajsa Anderson

-----Original Message-----
From: Yung Choi [mailto:choi@bea.com]
Sent: Monday, April 05, 2004 4:07 PM
To: Ant Users List
Subject: 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

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