Bill, I just submitted a proposal for adding the same "detached" processing to the Java task. I'll rework my patch to use your naming convention, i.e. "detach=true|false". Java already has an "output" attribute, so I don't need to fuss with that; is the "inwindow" attribute appropriate for the Java task?
One final question ... when do you plan on getting this committed? I'll try and have my changes done about the same time. Glenn. P.S. Attached is my original proposal. -----Original Message----- From: Bill Burton [mailto:[EMAIL PROTECTED] Sent: Thursday, February 08, 2001 9:12 PM To: [EMAIL PROTECTED] Subject: Re: [PATCH] fix for process spawning Hello, A number of people have asked for this kind of detached or background starting of an executable. I wrote generic support for this but didn't have it sufficiently tested before code freeze hit for the 1.3 release. What I've implemented allows the <exec> task (and it's subclasses) to run an executable detached in the background either redirecting the output to a file or opening a new window. This is done in a platform-independent manner (at least for Windows 9x/NT/2K and UNIX). The <exec> task supports four new attributes and one modified one: detach=true|false - if true, runs process detached in the background output=file-name - modified so this works when detach=true inwindow=true|false - if true, runs process detached in a new window. On Windows OS's opens a new console window. On UNIX, can run xterm, CDE dtterm, KDE konsole or gnome-terminal (and I plan to add screen). The type of window and geometry can be selected by exporting environment variables before running Ant. windowtitle="title of new window" - Title to display in new window when the inwindow attribute is set to true. usescript=true|false - When true, will always use the script launcher causing the antRun script to be called to execute the command. This works even if Ant is running in a 1.3 JVM. Something I may consider is writing new versions of Execute.runCommand that will support detached with output or detached in a window. This will make it easier for other tasks to use this functionality. As some of my changes conflict with at least one recently posted patch, I'll post a patch once things settle down with the 1.3 release. In the meantime, if anyone has comments on this functionality, I'm open to any input. -Bill Burton John Brush wrote: > > I am using Ant to do some development with weblogic server, and I ran into > some problems trying to get it to return after spawning a new process/window > at the command line (Windows 2000). A quick scan of this mail list showed me > I was not the first person to run into this problem. Unfortunatly I don't > have the time to research this in more detail (got a deadline end of Feb.), > but the attached patch has at least solved my problem. Perhaps it can serve > as a basis for something along these lines in a future release. <snip/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--- Begin Message ---I have the following problem: I want to run a Java class from within Ant, but I don't want to wait for execution of the class to complete. Example: I have written a servlet-based application. After the compile portion of my build completes, I want to start Tomcat and then execute my JUnit tasks. Proposed Solution: Add functionality to the Java task which allows the class to run in a separate thread. To access this functionality, an attribute (which I have been referring to as "parallel") is set to true. The default value for this attribute is false, so existing build xml will not need to be updated. Here is a diff of my proposed changes. I wanted to get a feel for interest in this change before completing the work. Please let me know what you think (as if you wouldn't!). Index: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java =================================================================== RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java ,v retrieving revision 1.24 diff -r1.24 Java.java 95a96,116 > class ParallelThread extends Thread { > Java java; > > ParallelThread(Java java) { > this.java = java; > } > > public void run() { > java.run(java.cmdl.getCommandline()); > } > } > > boolean parallel = false; > > /** > * Set the parallel flag. > */ > public void setParallel(boolean s) { > this.parallel = s; > } > 110,112c131,142 < log("Forking " + cmdl.toString(), Project.MSG_VERBOSE); < < return run(cmdl.getCommandline()); --- > if (parallel) { > log("Forking in parallel " + cmdl.toString(), Project.MSG_VERBOSE); > > ParallelThread thread = new ParallelThread(this); > thread.start(); > > return 0; > } else { > log("Forking " + cmdl.toString(), Project.MSG_VERBOSE); > > return run(cmdl.getCommandline()); > } Glenn. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--- End Message ---
