aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2016-04-09 07:47:53 +0000
committerGravatar Lukacs Berki <lberki@google.com>2016-04-11 11:21:39 +0000
commit759bbfedbd8acd1324211d68b69e302478428e32 (patch)
tree7ca581fcbb0720d598ef326fe4bec164dd0bf3c2 /src/main/java
parent63049ccb3fd64563ac5c6a46742aefc6fba4e568 (diff)
experimental UI: honor --curses
Bazel can be asked to uses colors, but not to use other curses options. In this case, the ExperimentalEventHandler cannot rely on the terminal to ignore all curses output; hence it has to actively refrain from using curses that move the cursor. -- Change-Id: I026edade4366a8c5a8e56d376e8a4603f5c73b92 Reviewed-on: https://bazel-review.googlesource.com/#/c/3291 MOS_MIGRATED_REVID=119439855
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java5
1 files changed, 5 insertions, 0 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 cfa284f7d9..e13b75b834 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
@@ -42,6 +42,7 @@ import java.util.logging.Logger;
public class ExperimentalEventHandler extends BlazeCommandEventHandler {
private static Logger LOG = Logger.getLogger(ExperimentalEventHandler.class.getName());
+ private final boolean cursorControl;
private final AnsiTerminal terminal;
private final boolean debugAllEvents;
private final ExperimentalStateTracker stateTracker;
@@ -54,6 +55,7 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler {
public ExperimentalEventHandler(
OutErr outErr, BlazeCommandEventHandler.Options options, Clock clock) {
super(outErr, options);
+ this.cursorControl = options.useCursorControl();
this.terminal = new AnsiTerminal(outErr.getErrorStream());
this.terminalWidth = (options.terminalColumns > 0 ? options.terminalColumns : 80);
this.debugAllEvents = options.experimentalUiDebugAllEvents;
@@ -224,6 +226,9 @@ public class ExperimentalEventHandler extends BlazeCommandEventHandler {
}
private void clearProgressBar() throws IOException {
+ if (!cursorControl) {
+ return;
+ }
for (int i = 0; i < numLinesProgressBar; i++) {
terminal.cr();
terminal.cursorUp(1);