Browse Source

Exec task may mix the stderr and stdout output while logging it. Bugzilla 50507

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1095736 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 14 years ago
parent
commit
fd52ae619b
6 changed files with 63 additions and 8 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +4
    -1
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +4
    -2
      src/main/org/apache/tools/ant/taskdefs/Redirector.java
  5. +2
    -5
      src/main/org/apache/tools/ant/util/LineOrientedOutputStream.java
  6. +48
    -0
      src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java

+ 1
- 0
CONTRIBUTORS View File

@@ -353,6 +353,7 @@ Victor Toni
Vincent Legoll
Waldek Herka
Will Wang
William Bernardet
William Ferguson
William Webber
Wolf Siberski


+ 4
- 1
WHATSNEW View File

@@ -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
===================================



+ 4
- 0
contributors.xml View File

@@ -1424,6 +1424,10 @@
<first>Will</first>
<last>Wang</last>
</name>
<name>
<first>William</first>
<last>Bernardet</last>
</name>
<name>
<first>William</first>
<last>Ferguson</last>


+ 4
- 2
src/main/org/apache/tools/ant/taskdefs/Redirector.java View File

@@ -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);


+ 2
- 5
src/main/org/apache/tools/ant/util/LineOrientedOutputStream.java View File

@@ -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();
}


+ 48
- 0
src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java View File

@@ -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();
}
}

Loading…
Cancel
Save