I'm not fond of forking processes either, but when you gotta go, you gotta
go ;-)

But even if you fork - it doesn't mean you have to be OS dependent though.
Ant executes (if specified to) many processes (JUnit, javac, etc) without
being OS dependent.

On 10/11/05, Ashley Williams <[EMAIL PROTECTED]> wrote:
>
> I didn't realize you were talking about Runtime.exec(). I did briefly
> consider it but
> then I didn't want to make my code OS dependent.
>
> Hobsons choice though!
>
> On 10 Oct 2005, at 23:02, Arik Kfir wrote:
>
> > No - look at the javadocs for the java.lang.Runtime class.
> >
> > The "Runtime.exec" method executes *another process" - in your case
> > another
> > JVM I assume. Therefor, when that other JVM's jaxme executes
> > System.exit -
> > it exists the second JVM and the "waitFor" method finishes...
> >
> > Look at the javadocs of the "Runtime" class for details...
> >
> > On 10/10/05, Ashley Williams <[EMAIL PROTECTED]> wrote:
> >
> >>
> >> Unless I missed something, aren't we back to square one because the
> >> line that goes
> >> //execute the process
> >>
> >> still does a System.exit.
> >>
> >> AW
> >>
> >> On 10 Oct 2005, at 18:10, Arik Kfir wrote:
> >>
> >>
> >>> I wouldn't copy the code - it will have to be maintained later
> >>> on...which is
> >>> tedious ;-)
> >>>
> >>> here's what I would do (heavy snipping..):
> >>>
> >>> public void executeXjc(String targetPackage, String
> >>> outputDirectory, String
> >>> schema) throws Exception {
> >>> // do stuff
> >>>
> >>> //
> >>> //execute the process
> >>> //
> >>> Object[] args = getArgs(arrayList).toArray();
> >>> Object[] cmd = new Object[args.length + 1];
> >>> cmd[0] = "xjc";
> >>> Process proc = System.arraycopy(args, 0, cmd, 1, args.length);
> >>>
> >>> //
> >>> //TODO: redirect output from 'proc' into your mojo's logger here
> >>> //
> >>>
> >>> //
> >>> //wait for the process to finish
> >>> //
> >>> int rc = proc.waitFor();
> >>>
> >>> //do more stuff
> >>> }
> >>>
> >>> On 10/10/05, Ashley Williams <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>>> Thanks, glad to know I'm not the only one.
> >>>>
> >>>> On 10 Oct 2005, at 16:10, Jesse McConnell wrote:
> >>>>
> >>>>
> >>>>
> >>>>> my wsdl2java plugin had the same problem..
> >>>>>
> >>>>> I ended up finding the source for the main method for the
> >>>>> wsdl2java
> >>>>> and just
> >>>>> wrote another version of it that didn't call the system.exit()
> >>>>>
> >>>>> that plugin in mojo if you want to take a look
> >>>>>
> >>>>> jesse
> >>>>>
> >>>>> On 10/10/05, Ashley Williams < [EMAIL PROTECTED]> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>>
> >>>>>> I believe if you modified your policy file to deny
> >>>>>> System.exit, you
> >>>>>> would get a SecurityException, also each plugin user
> >>>>>> would have to amend their policy file.
> >>>>>>
> >>>>>> On 10 Oct 2005, at 14:39, Milos Kleint wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> generally you can avoid System.exit by changing the security
> >>>>>>> policy. Not sure how it's relevant to running within maven.
> >>>>>>>
> >>>>>>> milos
> >>>>>>>
> >>>>>>> Ashley Williams wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>> I'm writing a plugin whose job it is to call Main.main in the
> >>>>>>>> jaxme jar file. However at the end of main, a call to
> >>>>>>>> System.exit
> >>>>>>>> () is made therefore stopping my plugin in its tracks. How
> >>>>>>>> would I
> >>>>>>>> handle this situation? I would imagine anyone who writes custom
> >>>>>>>> Ant taga (not me) must come across this all the time.
> >>>>>>>>
> >>>>>>>> Thanks
> >>>>>>>> AW
> >>>>>>>>
> >>>>>>>> ---------------------------------------------------------------
> >>>>>>>> --
> >>>>>>>> --
> >>>>>>>> --
> >>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> ----------------------------------------------------------------
> >>>>>>> --
> >>>>>>> --
> >>>>>>> -
> >>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>> -----------------------------------------------------------------
> >>>>>> --
> >>>>>> --
> >>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> jesse mcconnell
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>> -------------------------------------------------------------------
> >>>> --
> >>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to