From 51d8caa51e75a389cb620f96e05bd5cc3c1e991a Mon Sep 17 00:00:00 2001 From: Emmanuel Bigeon Date: Sun, 7 Nov 2021 11:22:40 +0100 Subject: [PATCH] [fix] Unclosed stream wrapped in delegating stream. Signed-off-by: Emmanuel Bigeon --- .../main/java/net/bigeon/gclc/manager/PipedConsoleOutput.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gclc/src/main/java/net/bigeon/gclc/manager/PipedConsoleOutput.java b/gclc/src/main/java/net/bigeon/gclc/manager/PipedConsoleOutput.java index 2432b4a..8753484 100644 --- a/gclc/src/main/java/net/bigeon/gclc/manager/PipedConsoleOutput.java +++ b/gclc/src/main/java/net/bigeon/gclc/manager/PipedConsoleOutput.java @@ -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(); }