ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Solofnenko <>
Subject RE: What to do if <exec>ed program hangs?
Date Tue, 02 Jul 2002 00:08:31 GMT
Thank you, but replacing existing tasks is dangerous, unless the code will
go into ANT sources. I am already using beta 3. I will try your sources.

  Alexey Solofnenko.

-----Original Message-----
From: Hal Hildebrand (web) []
Sent: Saturday, June 29, 2002 7:39 PM
To: Ant Users List
Subject: Re: What to do if <exec>ed program hangs?
Importance: High

Attached are two patched files to Ant 1.5 beta 2.  With these fixes you
can do:

    <target name="testy" >
                ...  Do your testing here ...
                <property name="short_regress_done" value="yes" />
                <waitfor maxwait="10}"
                    <isset property="test_done" />
                <fail unless="test_done" message="Test timed out!" />

The patched Parallel task's semantics are changed.  If any one of the
parallel threads of the task throws an exception, all the threads are
interrupted.  This means that if you do

            ... start your server ...
            ... wait for server to come up ...
            ... do your tests ...
            ... shutdown the server ...

and an exception occurs (such as a build exception) in the second
sequential task, the parallel task will exit after interrupting the
first thread.

This is where the second patched file, Execute comes in.  The patch here
is to handle the InterruptedException correctly (or at least handle it)
by always ensuring that the process is destroyed.

Thus if a build exception occurs, the first task (which spawns the
application server process) is interrupted and the process is killed.
Combined with the use of a timeout using the waitfor task, it's a leash
to yank back those pesky processes and make 'em heel.

Combined with the try-finally task from the source forge ant contrib,
you pretty much have all the elements to manage multiple processes in

----- Original Message -----
From: "Alexey Solofnenko" <>

> Hello,
>   we are performing unit testing of our RMI servers during build
process on
> Windows. The tests are started from ANT, but execute in a different
> environment. Unfortunately the servers not always stop correctly and
> build hangs. What would be a good way to kill the processes, so ANT
> will continue?
> - Alexey.
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message