Browse Source

Fixed problem which gave (on Windows) output such as:

[java] First line of real output
[java]
[java] Second line of real output
[java]


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271563 13f79535-47bb-0310-9956-ffa450edef68
master
Jon Skeet 23 years ago
parent
commit
f4f7024234
1 changed files with 18 additions and 1 deletions
  1. +18
    -1
      src/main/org/apache/tools/ant/DemuxOutputStream.java

+ 18
- 1
src/main/org/apache/tools/ant/DemuxOutputStream.java View File

@@ -139,9 +139,25 @@ public class DemuxOutputStream extends OutputStream {
*/
private void resetBufferInfo() {
Thread current = Thread.currentThread();
buffers.remove(current);
BufferInfo bufferInfo = (BufferInfo)buffers.get(current);
try {
bufferInfo.buffer.close();
}
catch (IOException e) {
// Shouldn't happen
}
bufferInfo.buffer = new ByteArrayOutputStream();
bufferInfo.skip = false;
}
/**
* Removes the buffer for the current thread.
*/
private void removeBuffer() {
Thread current = Thread.currentThread();
buffers.remove (current);
}

/**
* Writes the data to the buffer and flushes the buffer if a line
* separator is detected or if the buffer has reached its maximum size.
@@ -189,6 +205,7 @@ public class DemuxOutputStream extends OutputStream {
*/
public void close() throws IOException {
flush();
removeBuffer();
}

/**


Loading…
Cancel
Save