ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Hennessy" <>
Subject RE: Fire and forget exec task
Date Tue, 27 Nov 2001 22:02:56 GMT
Hi Charles,

You should consider using the <parallel> task which already does what
you want. It allows you to spawn multiple tasks in parallel and execute
independent code in each. An example of using this in included below
which starts an app. server, runs a series of test scripts and then
shuts it down again. I've also added my <waitfor> task which I'm hoping
one of the commiters will consider soon (hint, hint). If you'd like to
try it, it's in the mail archive (or mail me if you want a prebuilt


    <target name="test" depends="deploy, create-test-env">
            <wlrun beahome="${weblogic.dir}"
                <waitfor maxwait="5m" checkevery="200ms">
                    <http url="http://localhost:7001/index.html"/>
                <junit fork="yes" printsummary="yes" haltonfailure="no">
                    <!-- junit config -->
                <wlstop beahome="${weblogic.dir}"

> -----Original Message-----
> From: Charles Hudak [] 
> Sent: 27 November 2001 19:02
> To: ''
> Subject: Fire and forget exec task
> Hi,
> I'm new to the list and I wasn't getting any feedback from 
> the users-list so I'm hoping I can get some feedback here.
> In our developement environment, we are creating custom 
> scripts to automatically deploy new builds to our application 
> servers. This requires us to first stop the server(s), deploy 
> the new web app and then restart the server. The exec task 
> works fine for stopping the server but, as I'm sure you know, 
> doesn't work for starting the server as the process spawned 
> by the exec task doesn't finish and the Ant build hangs.
> I'm wondering if anyone else has encountered a need for the 
> ability to 'fire and forget' an executable during a build or 
> deploy process?
> FWIW, I've hacked the exec task to allow a new attribute 
> 'waitFor' that allows you to control whether the task waits 
> for the spawned process to finish. This value is passed to 
> the Execute object that is created which then either waits 
> for the process to finish and returns the actual exit code or 
> simply returns 0 and allows Ant to continue.
> I encountered one problem, however, in the 
> PumpStreamHandler's stop() method. This method join()'s the 
> I/O stream threads (actually, handlers,
> thereof) of the process which still causes Ant to hang. A 
> workaround is to pass a timeout value to join() so that it 
> doesn't wait forever. This all seems to work. I'm curious if 
> anyone sees any issues in having join() timeout after, say, 
> 500-1000 ms?
> In any event, I'm open for other suggestions on how to craft 
> a solution to this problem so I don't have to do a custom 
> build of Ant to distribute to our development team. Is there 
> any possiblity that these changes might be included in future builds?
> Thanks!
> Charles Hudak
> Software Engineer
> YouZoom, Inc.
> --
> To unsubscribe, e-mail:   
> <mailto:ant-dev->>
> For 
> additional commands, 
> e-mail: <>

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

View raw message