epicer gradle output

This commit is contained in:
Leijurv 2019-02-03 19:27:28 -08:00
parent 913247996e
commit d799fac688
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -298,8 +298,8 @@ public class ProguardTask extends BaritoneGradleTask {
.start(); .start();
// We can't do output inherit process I/O with gradle for some reason and have it work, so we have to do this // We can't do output inherit process I/O with gradle for some reason and have it work, so we have to do this
this.printOutputLog(p.getInputStream()); this.printOutputLog(p.getInputStream(), System.out);
this.printOutputLog(p.getErrorStream()); this.printOutputLog(p.getErrorStream(), System.err);
// Halt the current thread until the process is complete, if the exit code isn't 0, throw an exception // Halt the current thread until the process is complete, if the exit code isn't 0, throw an exception
int exitCode = p.waitFor(); int exitCode = p.waitFor();
@ -308,12 +308,12 @@ public class ProguardTask extends BaritoneGradleTask {
} }
} }
private void printOutputLog(InputStream stream) { private void printOutputLog(InputStream stream, PrintStream outerr) {
new Thread(() -> { new Thread(() -> {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
System.out.println(line); outerr.println(line);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();