package droplauncher.util;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * Class for consuming output from an input stream.
 */
public class StreamGobbler extends Thread {

  private static final Logger LOGGER = LogManager.getLogger();

  private InputStream inputStream;

  private StreamGobbler() {}

  public StreamGobbler(InputStream inputStream) {
    this.inputStream = inputStream;
  }

  //TODO: Check if thread failed and provide some indication other than throwing an error to the log.
  @Override
  public void run() {
    try {
      BufferedReader br = new BufferedReader(new InputStreamReader(this.inputStream, StandardCharsets.UTF_8));
      String line;
      while ((line = br.readLine()) != null) {
//        if (this.line.startsWith("fps: ")) {
//          continue;
//        }
        System.out.println(line);
      }
    } catch (Exception ex) {
      LOGGER.error(ex);
    }
  }

}

@@ -32,90 +32,219 @@
 ort 
-java.io.BufferedReader;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamRead
+adakite.util.AdakiteUtils;%0Aimport java.io.BufferedReader;%0Aimport java.io.BufferedWriter;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.io.OutputStream;%0Aimport java.io.OutputStreamWrit
 er;%0A
@@ -573,16 +573,53 @@
 tStream;
+%0A  private OutputStream outputStream;
 %0A%0A  priv
@@ -728,16 +728,202 @@
 Stream;%0A
+    this.outputStream = null;%0A  %7D%0A%0A  public StreamGobbler(InputStream inputStream, OutputStream outputStream) %7B%0A    this.inputStream = inputStream;%0A    this.outputStream = outputStream;%0A
   %7D%0A%0A  /
@@ -1176,16 +1176,195 @@
 TF_8));%0A
+      BufferedWriter bw = null;%0A      if (this.outputStream != null) %7B%0A        bw = new BufferedWriter(new OutputStreamWriter(this.outputStream, StandardCharsets.UTF_8));%0A      %7D%0A
       St
@@ -1536,16 +1536,125 @@
 (line);%0A
+        if (bw != null) %7B%0A          bw.write(line + AdakiteUtils.newline());%0A          bw.flush();%0A        %7D%0A
       %7D%0A

Add an "OutputStream" option to "StreamGobbler.java"