Return-Path: Mailing-List: contact user-help@ant.apache.org; run by ezmlm Delivered-To: mailing list user@ant.apache.org Received: (qmail 52866 invoked from network); 7 Apr 2003 15:30:50 -0000 Received: from web20407.mail.yahoo.com (HELO web20419.mail.yahoo.com) (66.163.169.95) by daedalus.apache.org with SMTP; 7 Apr 2003 15:30:50 -0000 Message-ID: <20030407153052.78659.qmail@web20419.mail.yahoo.com> Received: from [208.128.243.49] by web20407.mail.yahoo.com via HTTP; Mon, 07 Apr 2003 08:30:52 PDT Date: Mon, 7 Apr 2003 08:30:52 -0700 (PDT) From: Matt Benson Subject: Re: "destroy"-ing an Ant exec doesn't destroy what Ant is "exec"-ing... To: Ant Users List In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N They do not call Ant's main; rather they imitate what it does without calling System.exit(). Another (wrong) way to do it is to install a SecurityManager that does not permit System.exit() to be called, call main and catch the SecurityException. -Matt --- Rich Wagner wrote: > 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 "" task that > does *NOT* fork, then if that "" 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 "" > 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 > "" 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 > ""/System.exit problem, and if so, how ? > > -- Rich Wagner > > > >From: Stefan Bodewig > >Reply-To: "Ant Users List" > >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 > 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 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > user-unsubscribe@ant.apache.org > For additional commands, e-mail: > user-help@ant.apache.org > __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com