DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16347>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16347

[Proposal] Running task asynchrously

           Summary: [Proposal] Running task asynchrously
           Product: Ant
           Version: 2.0 spec
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


HI,

attached is a tentative patch that allow a Task object to run
asychronously. I have tested the patch on Solaris and win2k and
everything works fine (without breaking backward compatibility).

To use the functionality, you just have to add to a task the spawn
attribute, e.g.:

<exec dir="c:/src/jakarta-tomcat-5/build/bin/" executable="sh" spawn="true">

Since some task needs a couple of seconds to start/stop, I also added a
spawnWaitUntil attribute where you can set the time required before
moving to the next Task.

I did no wrote a <spawn> task because I think the functionality should
be available to every Task. For now I did not add the functionality to
Java, Javac, Jar.

Let me know what you think. At least I have something use when <gump>ing 
tomcat :-)

Thanks,

-- Jeanfrancois
----------------------------------------------------------------------------
Dominique Devienne wrote:

>Thanks for all the hard work Jean-Francois.
>
>1) Could you open a new BugZilla enhancement, and attach you patch there?
>This would allow to discuss you changes there, easily referenceable.
>
>2) Why did you have to modify Task.java? It doesn't seem warranted, and
>probably will not fly well with the committers.

I shouldl read the email list more often :-) In my opinion, a spawn
functionality could be available not only for Exec, but also for Copy, Java,
Javac, Jar etc. It is maybe a false assumption.....


>
>3) Any chance you might be able to write unit tests specific to the 'spawn'
>mode of <exec>?

Will do. I should know that working on Tomcat :-)


>
>Also, what happens of the spawned process stdin/stdout/stderr? Do you force
>redirecting to a file? If I spawn a process from Ant, Ant finishes, and I
>close the console, will the program stop and/or hang and/or its output will
>simply be lost???

the spawnWaitUntil attribute cover partially that purpose. The
stdin/stdout/stderr will be gathered until this value timeout. That's probably
not the proper behaviour if we want to gather all the stdin/stdout/stderr. The
current patch will loose the stdin/stdout/stderr. That should not be difficult
to force ant to listen until all spawn tasks complete. A simple
subsriber/listener mechanim can do that.

One question. Should we kill all spawned task if ant is stopped?

>
>Thanks, --DD
>

Thanks.

-- Jeanfrancois

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to