[fix] Unclosed stream wrapped in delegating stream.

Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
Emmanuel Bigeon 2021-11-07 11:22:40 +01:00
parent 72f768e6de
commit 51d8caa51e

View File

@ -101,13 +101,14 @@ public final class PipedConsoleOutput implements ConsoleOutput {
private final PrintStream outPrint;
/** The reading thread. */
private final ReadingRunnable reading;
private final PipedOutputStream out;
/** Create a manager that will write and read through piped stream.
*
* @throws IOException if the piping failed for streams */
public PipedConsoleOutput() throws IOException {
commandOutput = new PipedInputStream();
final PipedOutputStream out = new PipedOutputStream(commandOutput);
out = new PipedOutputStream(commandOutput);
commandBuffOutput = new BufferedReader(
new InputStreamReader(commandOutput, StandardCharsets.UTF_8));
outPrint = new PrintStream(out, true, UTF_8);
@ -133,6 +134,7 @@ public final class PipedConsoleOutput implements ConsoleOutput {
reading.setRunning(false);
innerManager.close();
outPrint.close();
out.close();
commandBuffOutput.close();
commandOutput.close();
}