ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vimil Saju <vimils...@yahoo.com>
Subject Re: Regarding exec task
Date Sun, 12 Feb 2012 16:27:13 GMT
I could do that, but I will have to copy all the code from the execute class that does stuff
like adding hooks to destroy processes when the jvm exits, parsing command-line arguments
etc, when all I want to do is override how processes created by ant are destroyed. Besides
even if I were to create another exec task, none of the built-in ant tasks that support the
fork attribute (like java task) are going to call my class to create processes. From looking
at the ant source code, I see that all tasks use to the 'Execute' class for process creation.
I was thinking if the Execute class allowed the process creation code to be overridden then
I could provide a new process destruction mechanism and it will be invoked by all the built-in
tasks that support the fork attribute. 

From: wolfgang häfelinger <whaefelinger@gmail.com>
To: Ant Developers List <dev@ant.apache.org>; Vimil Saju <vimilsaju@yahoo.com>

Sent: Sunday, February 12, 2012 7:32 AM
Subject: Re: Regarding exec task
 
> Is it possible to make the Execute class in ant extensible so that it becomes possible
to plugin our own implementation of Process class.

Implement your own ueber-exec taks which uses default exec class when
not-on windows and otherwise makes use of your own jvnet-process exec
task.

On Sun, Feb 12, 2012 at 3:29 PM, Vimil Saju <vimilsaju@yahoo.com> wrote:
>
>
>
>
> Hi,
>
> I noticed that on windows, if I use the exec task to run a batch script which in turn
starts other processes then if kill ant then the sub-processes created by the batch script
still continues to run. I did some research on google and found that the default java implementation
of Process.destroy does not kill the child processes created by a process on windows. I also
found that there are some third party libraries like jvnet that provide the capability of
killing all processes created by a process on windows.
>
> So I thought of somehow extending the 'Execute' class of ant to use the functionality
of this 3rd party library, but I find that its difficult if not impossible to extend this
class. I can't find a way to provide my implementation of Process class that does something
different when its destroy method is called. Other core tasks such as java task directly create
an instance of the 'Execute' class which makes it difficult to globally change how a forked
process is destroyed within ant.
>
> Is it possible to make the Execute class in ant extensible so that it becomes possible
to plugin our own implementation of Process class.
>
>
> Thanks
>
> Vimil



-- 
Wolfgang Häfelinger

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message