ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rich Wagner" <richmwag...@hotmail.com>
Subject Re: "destroy"-ing an Ant exec doesn't destroy what Ant is "exec"-ing...
Date Mon, 07 Apr 2003 15:24:21 GMT
Stefan:  Thanks for the reply.  I (obviously) wasn't familiar with shutdown 
hooks, so I'll probably look at the Ant source, both for that shutdown code 
(to see how it works) and at Main, for potential cloning.

I did consider, though, not "exec"-ing Ant in its own VM, and instead 
calling its "main" directly.  But I'm concerned that whether I call "main" 
or a clone that my GUI front end for Ant will inherit what seems to be a 
problem in Ant itself.  That is, if a build file uses a "<java>" task that 
does *NOT* fork, then if that "<java>" program calls "System.exit()", it 
causes Ant to exit !  (Whether Ant had other targets/tasks to complete or 
not...)

My GUI spawns an "exec"-ed Ant Process each time one of the GUI's buttons is 
pressed: that way, even it a single Ant invocation dies (because a "<java>" 
task "System.exit"s and kills Ant in the process), at least my GUI sticks 
around.  If I switched to running my GUI in the same VM as Ant, then a 
"<java>" task's "System.exit" would kill my GUI too...

>Most Ant IDE integrations do not execute Ant in a separate VM.  You
>may be able to get some ideas of the Open Source versions of existing
>IDE integrations (NetBeans, Eclipse, the JBuilder AntRunner and
>probably others are Open Source).

Do you know whether these IDE front ends have to work-around this 
"<java>"/System.exit problem, and if so, how ?

-- Rich Wagner


>From: Stefan Bodewig <bodewig@apache.org>
>Reply-To: "Ant Users List" <user@ant.apache.org>
>To: user@ant.apache.org
>Subject: Re: "destroy"-ing an Ant exec doesn't destroy what Ant is 
>"exec"-ing...
>Date: 07 Apr 2003 10:05:15 +0200
>
>On Mon, 07 Apr 2003, Rich Wagner <richmwagner@hotmail.com> wrote:
>
> > If I hit the "Stop" button while my Ant build file is in the middle
> > of "exec"-ing that "build.exe" sub-Process, the "destroy" call
> > *DOES* kill Ant, but Ant does not - in turn - "destroy" the
> > "build.exe" sub-process.
>
>Ant will try to kill the spawned processes in it's shutdown hook
>(given a Java VM recent enough to support shutdown hooks and Ant >=
>1.5 that is).
>
>I've found that at least on Unix shutdown hooks will not be called by
>the VM if you kill the spawned process with enough violence (i.e.
>kill -9 doesn't, a simple kill usually does).
>
>If Ant's VM has no chance to call the shutdown hooks, there probably
>isn't anything you can do.
>
> > Anyway, details aside, is there maybe a different way (other than
> > "exec") that I can run "Ant"
>
>Sure.  Look what Main does and clone it (don't use Main directly, its
>not suitable for that).
>
>
>Stefan
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


Mime
View raw message