commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r170378 - /jakarta/commons/proper/jelly/trunk/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTag.java
Date Mon, 16 May 2005 12:56:55 GMT
Author: dion
Date: Mon May 16 05:56:54 2005
New Revision: 170378

URL: http://svn.apache.org/viewcvs?rev=170378&view=rev
Log:
Apply JELLY-209

Modified:
    jakarta/commons/proper/jelly/trunk/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTag.java

Modified: jakarta/commons/proper/jelly/trunk/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTag.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTag.java?rev=170378&r1=170377&r2=170378&view=diff
==============================================================================
--- jakarta/commons/proper/jelly/trunk/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTag.java
(original)
+++ jakarta/commons/proper/jelly/trunk/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTag.java
Mon May 16 05:56:54 2005
@@ -16,6 +16,7 @@
 
 package org.apache.commons.jelly.tags.ant;
 
+import java.io.PrintStream;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -34,6 +35,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DemuxOutputStream;
 import org.apache.tools.ant.IntrospectionHelper;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
@@ -182,7 +184,19 @@
 
                 // now we're ready to invoke the task
                 // XXX: should we call execute() or perform()?
-                task.perform();
+                // according to org.apache.tools.ant.Main, redirect stdout and stderr
+                PrintStream initialOut = System.out;
+                PrintStream initialErr = System.err;
+                PrintStream newOut = new PrintStream(new DemuxOutputStream(project, false));
+                PrintStream newErr = new PrintStream(new DemuxOutputStream(project, true));
+                try {
+                    System.setOut(newOut);
+                    System.setErr(newErr);
+                    task.perform();
+                } finally {
+                    System.setOut(initialOut);
+                    System.setErr(initialErr);
+                }
             }
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message