ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <j_a_fernan...@yahoo.com>
Subject RE: exec in thread
Date Fri, 20 Apr 2001 18:15:48 GMT
Well, in UNIX it may be more complicated.

I think the correct syntax is:

	/bin/sh -c '......... &'

in other words there is only one parameter after the -c which contains the
entire command line. Which will bring all the nightmare of quoting the
command line correctly to the front. So I think it will mean adding
something to the exec command or, probably better, defining a new task,
subclass of Exec that knows how to quote things properly for each OS.

	<start ...... />

Does any one knows how to do such thing on Mac OS? I have absolutely no
clue.

Jose Alberto

> -----Original Message-----
> From: Halim, Salman [mailto:salman@Bluestone.com]
> Sent: Friday, April 20, 2001 6:25 PM
> To: 'ant-dev@jakarta.apache.org'
> Subject: RE: exec in thread
>
>
> that's what i was thinking, too; i was thinking of either
> tweaking the exec
> task to accept a "background=true" (false by default so as to
> not conflict
> with existing scripts) attribute that would prepend a "start" or the
> "/bin/sh" (with "&" appended), depending on the os.
>
> then, i thought, what if i use a simple launcher which calls
> ant with a
> -DcommandStart="/bin/sh -c" -DcommandEnd="&" on unix and
> "start" and "",
> respectively, on windows and just change all my commands to start with
> ${commandStart} as the executable and ${commandEnd} as the
> very last part.
> need to look into this, though i have a feeling the unix
> variant being two
> words will require a bit more tweaking.
>
> thoughts?
>
> --
> Salman Halim
> Advisory Software Engineer, HP Bluestone
> Quidquid latine dictum sit, altum viditur.
>
>
> -----Original Message-----
> From: Jose Alberto Fernandez [mailto:j_a_fernandez@yahoo.com]
> Sent: Friday, April 20, 2001 12:05 PM
> To: ant-dev@jakarta.apache.org
> Subject: RE: exec in thread
>
>
> I have had simillar kinds of needs and would also like some
> way to achieve
> it. In my case I wanted to use it for starting server processes, e.g.,
> tomcat servers that must stay running in the background.
>
> For example to run tests, I need to have the servers running
> first and only
> then can I dispatch things to it. I do not want the servers
> to go up and
> down all the time.
>
> We could do such things using the "start" command on NT and
> "/bin/sh -c ...
> &" on UNIX, do not know about other systems.
>
> Any ideas?
>
> Jose Alberto
>
> > -----Original Message-----
> > From: Halim, Salman [mailto:salman@Bluestone.com]
> > Sent: Friday, April 20, 2001 4:21 PM
> > To: 'ant-dev@jakarta.apache.org'
> > Subject: RE: exec in thread
> >
> >
> > i appreciate your response.  thank you.
> >
> > i understand what you're saying about possible
> > synchronization or deadlock
> > issues with a parallel execution.  my intention is to start a
> > process that
> > will keep running long after the ant build is done.
> > basically, i'm not
> > using ant to install anything, per se.  i'm using ant's
> > platform independent
> > way of specifying environment variables to basically act as a
> > launcher that
> > will allow me to launch a process on both windows and unix
> > using just this
> > one configuration file.  (rather than having a windows batch
> > file AND a
> > separate unix shell script:  two things to maintain.  this is
> > what we have
> > right now.)
> >
> > i had initially toyed with the idea of writing a (much
> > simpler) application
> > from scratch that would basically accept an xml file
> > describing environment
> > variable settings, things to launch, whether to do it in the
> > background etc.
> > and would then generate both windows batch files as well as
> unix shell
> > scripts from that.  however, i figured using ant would allow
> > me to NOT have
> > to do all that coding by hand :) even though ant wasn't
> > necessarily designed
> > for the task.
> >
> > what i need to be able to do is start more than one process,
> > each running in
> > parallel (otherwise, i have nothing against letting the ant
> > "build" keep
> > running).
> >
> > any thoughts on this approach would be appreciated.
> >
> > thanks again!
> >
> > --
> > Salman Halim
> > Advisory Software Engineer, HP Bluestone
> > Quidquid latine dictum sit, altum viditur.
> >
> >
> > -----Original Message-----
> > From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
> > Sent: Friday, April 20, 2001 10:52 AM
> > To: ant-dev@jakarta.apache.org
> > Subject: Re: exec in thread
> >
> >
> > Salman,
> >
> > A couple of issues. I understand this is incomplete and there
> > are therefore
> > some issues you have yet to encounter.
> >
> > Firstly, we have been discussing supporting parallel
> > execution of tasks
> > within a target. This will satisfy a number of needs to
> > either run test
> > harnesses against servers or to better utilise powerful
> > hardware during a
> > build. A possible expression might be
> >
> > <target>
> >    <parallel>
> >        <javac>
> >        <javac>
> >    </parallel>
> > </target>
> >
> > Now, that is not quite what you are proposing - you are
> basically just
> > running the thread and forgetting about it - you don't join
> > to that thread
> > again. Rather than tackle this for the particular task
> > (exec), this could
> > be approached as
> >
> > <target>
> >     <daemon>
> >         <exec>
> >     </daemon>
> > </target>
> >
> > Thus any task could be run in the background and not just
> > exec. I think,
> > however, we need to think carefully about the implications
> of threads
> > running while ant continues to run. If the thread continues
> > to interact
> > with Ant there may be synchronization or deadlock issues.
> > Also the thread
> > may keep the Ant VM alive when Ant itself has finished.
> >
> > Anyway, if you continue to go with your task, I think one
> > issue you will
> > encounter is the management of the output of the exec task
> > and connecting
> > that into Ant's event mechanism.
> >
> > Conor
> >
> >
> >
> >
> > ----- Original Message -----
> > From: "Halim, Salman" <salman@Bluestone.com>
> > To: <ant-dev@jakarta.apache.org>
> > Sent: Saturday, April 21, 2001 12:05 AM
> > Subject: FW: exec in thread
> >
> >
> > > hi,
> > >
> > > i didn't recieve a response last time so i'm trying
> again. . .  any
> > advice
> > > is appreciated.  thank you!
> > >
> > > --
> > > Salman Halim
> > > Advisory Software Engineer, HP Bluestone
> > > Quidquid latine dictum sit, altum viditur.
> > >
> > >
> > > -----Original Message-----
> > > From: Halim, Salman [mailto:salman@Bluestone.com]
> > > Sent: Tuesday, April 17, 2001 3:56 PM
> > > To: 'ant-user@jakarta.apache.org'; 'ant-dev@jakarta.apache.org'
> > > Subject: exec in thread
> > >
> > >
> > > hi,
> > >
> > > i have the attached MyExec class; this is supposed to be
> a primitive
> > > replacement for the exec task that will run its target in
> > the background
> > (by
> > > spawning a thread and running in there).  it isn't complete
> > yet, but i
> > > wanted to do some testing before going any further:
> > >
> > > in short, the thread doesn't continue to run once the main
> > class is done.
> > > if i uncomment the delay loop in there, then it runs
> > (because the main
> > > MyExec is still running).
> > >
> > > can anybody see if i'm doing something anti-ant in there,
> > please?  this
> > > class is not very complicated, i promise!
> > >
> > > thank you in advance,
> > >
> > > --
> > > Salman Halim
> > > Advisory Software Engineer, HP Bluestone
> > > Quidquid latine dictum sit, altum viditur.
> > >
> > >
> > >
> > >
> >
>


Mime
View raw message