aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2016-02-25 11:56:02 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-02-25 14:15:54 +0000
commited51bd75a24b5fb8ccf4fd38bf6140697f8f7de0 (patch)
tree5a1027d5dda5f537abb729c3c9edd3667ffac5c1 /src
parentbffec60d65d908ed9fd138f8c7a73613dd4f654e (diff)
Pass through STDOUT and STDERR events
These events explicitly tell out to produce a well-defined message on stdout or stderr. Also in the new UI, honor those requests. -- Change-Id: I4188c6cb3a2e277b5b805b3d4f4c96c2cdc7b51c Reviewed-on: https://bazel-review.googlesource.com/#/c/3015 MOS_MIGRATED_REVID=115546439
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java19
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) {