diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java index 70c5bae688..6b710c21b7 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java @@ -15,12 +15,14 @@ package com.google.devtools.build.lib.runtime; import com.google.common.eventbus.Subscribe; import com.google.devtools.build.lib.events.Event; +import com.google.devtools.build.lib.events.EventKind; import com.google.devtools.build.lib.pkgcache.LoadingPhaseCompleteEvent; import com.google.devtools.build.lib.util.io.AnsiTerminal; import com.google.devtools.build.lib.util.io.AnsiTerminalWriter; import com.google.devtools.build.lib.util.io.OutErr; import java.io.IOException; +import java.io.OutputStream; import java.nio.charset.StandardCharsets; import java.util.logging.Logger; @@ -47,7 +49,7 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler { } @Override - public void handle(Event event) { + public synchronized void handle(Event event) { try { clearProgressBar(); if (debugAllEvents) { @@ -55,8 +57,21 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler { terminal.flush(); outErr.getOutputStream().write((event + "\n").getBytes(StandardCharsets.UTF_8)); outErr.getOutputStream().flush(); + } else { + switch (event.getKind()) { + case STDOUT: + case STDERR: + terminal.flush(); + OutputStream stream = + event.getKind() == EventKind.STDOUT + ? outErr.getOutputStream() + : outErr.getErrorStream(); + stream.write(event.getMessageBytes()); + stream.write(new byte[] {10, 13}); + stream.flush(); + break; + } } - // The actual new UI. addProgressBar(); terminal.flush(); } catch (IOException e) { |