diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 86d51dfe2..d6fbc9158 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -353,6 +353,7 @@ Victor Toni Vincent Legoll Waldek Herka Will Wang +William Bernardet William Ferguson William Webber Wolf Siberski diff --git a/WHATSNEW b/WHATSNEW index 317f0285b..08823b846 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -44,6 +44,9 @@ Fixed bugs: It will now fail with a more useful error message. Bugzilla Report 51035. + * Exec task may mix the stderr and stdout output while logging it + Bugzilla Report 50507. + Other changes: -------------- @@ -62,7 +65,7 @@ Other changes: * The expandproperties filter now accepts a nested propertyset which, if specified, provides the properties for expansion. Bugzilla Report 51044. - + Changes from Ant 1.8.1 TO Ant 1.8.2 =================================== diff --git a/contributors.xml b/contributors.xml index 6bb5aed5d..b0d02c8a2 100644 --- a/contributors.xml +++ b/contributors.xml @@ -1424,6 +1424,10 @@ Will Wang + + William + Bernardet + William Ferguson diff --git a/src/main/org/apache/tools/ant/taskdefs/Redirector.java b/src/main/org/apache/tools/ant/taskdefs/Redirector.java index 6e3e28a99..70fcb27f6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Redirector.java +++ b/src/main/org/apache/tools/ant/taskdefs/Redirector.java @@ -37,6 +37,8 @@ import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.Task; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.filters.util.ChainReaderHelper; +import org.apache.tools.ant.util.LineOrientedOutputStream; +import org.apache.tools.ant.util.LineOrientedOutputStreamRedirector; import org.apache.tools.ant.util.StringUtils; import org.apache.tools.ant.util.TeeOutputStream; import org.apache.tools.ant.util.ReaderInputStream; @@ -720,8 +722,8 @@ public class Redirector { OutputStreamFunneler funneler = new OutputStreamFunneler( outputStream, funnelTimeout); try { - outputStream = funneler.getFunnelInstance(); - errorStream = funneler.getFunnelInstance(); + outputStream = new LineOrientedOutputStreamRedirector(funneler.getFunnelInstance()); + errorStream = new LineOrientedOutputStreamRedirector(funneler.getFunnelInstance()); } catch (IOException eyeOhEx) { throw new BuildException( "error splitting output/error streams", eyeOhEx); diff --git a/src/main/org/apache/tools/ant/util/LineOrientedOutputStream.java b/src/main/org/apache/tools/ant/util/LineOrientedOutputStream.java index 30e5d88b9..6f15defc1 100644 --- a/src/main/org/apache/tools/ant/util/LineOrientedOutputStream.java +++ b/src/main/org/apache/tools/ant/util/LineOrientedOutputStream.java @@ -66,10 +66,7 @@ public abstract class LineOrientedOutputStream extends OutputStream { * Flush this log stream * @throws IOException if there is an error. */ - public final void flush() throws IOException { - if (buffer.size() > 0) { - processBuffer(); - } + public void flush() throws IOException { } /** @@ -97,7 +94,7 @@ public abstract class LineOrientedOutputStream extends OutputStream { * Writes all remaining * @throws IOException if there is an error. */ - public final void close() throws IOException { + public void close() throws IOException { if (buffer.size() > 0) { processBuffer(); } diff --git a/src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java b/src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java new file mode 100644 index 000000000..b703e43a6 --- /dev/null +++ b/src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.tools.ant.util; + +import java.io.IOException; +import java.io.OutputStream; +/** + * provide a concrete implementation of LineOrientedOutputStream + * @since Ant 1.8.3 + * + */ +public class LineOrientedOutputStreamRedirector + extends + LineOrientedOutputStream { + private OutputStream stream; + public LineOrientedOutputStreamRedirector(OutputStream stream) { + this.stream = stream; + } + + protected void processLine(String line) throws IOException { + stream.write((line + System.getProperty("line.separator")).getBytes()); + } + + public void close() throws IOException { + super.close(); + stream.close(); + } + + public void flush() throws IOException { + super.flush(); + stream.flush(); + } +}