ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Burton <>
Subject [SUBMIT] Support for detached <exec> on Unix and Windows
Date Thu, 23 Jan 2003 00:24:35 GMT

Earlier today, I posted scripts to ant-user 
( for 
background command execution via <exec>.  Installation just entails 
dropping the script files into ANT_HOME/bin.  Then you just specify the 
<exec> task appropriately in your build.xml.

Unlike other solutions posted here which change the PumpStreamHandler 
and Execute classes, this one allows starting long lived processes that 
can remain running after the build file exits.  It works by starting the 
desired command in such a way that all of stdin, stdout and stderr have 
been closed or redirected.  Then, when the command is run in the 
background, PumpStreamHandler won't hold onto those streams allowing the 
command to continue running without Ant waiting for it to exit.

For this support on Windows, I used JScript (JavaScript) in Windows 
Scripting Host, a scripting environment included with Windows 
98/Me/2000/XP.  For Windows 95/NT, WSH can be downloaded from Microsoft. 
  This seemed to me the best solution as Ant doesn't distribute binaries 
of any kind and I didn't want to try and be the first to try and start.

I suppose the next step might be to write wrapper tasks for this 
functionality which extend <exec> and <java> ant could work with 1.5. 
For 1.6, <exec> and <java> could be enhanced to use these scripts 
directly when the appropriate attribute is specified.



To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message