diff options
author | Klaus Aehlig <aehlig@google.com> | 2018-04-25 00:56:05 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-25 00:57:44 -0700 |
commit | 553066fc451f448be1c1705a55b88fd033f3d230 (patch) | |
tree | 0aecd087ac0f8ad0b7b2ac57a4d4dfa0aec7f980 | |
parent | e48ceba478b7fc1c4b22ff77bd61bd134848aa74 (diff) |
ExperimentalEventHandler: properly complete build
When completing the build and doing the final flush of the
incomplete stdout/stderr lines, remove any existing progress
bar first (and redraw afterwards) to avoid interference.
Also, upon receiving the AfterCommandEvent, just call
completeBuild instead of trying to do the same manually
again.
Change-Id: If375be798a5e66558676f0ffb845fb64279584f8
PiperOrigin-RevId: 194203925
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/ExperimentalEventHandler.java | 24 |
1 files changed, 21 insertions, 3 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 863cf0fea6..1bf0e008b7 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 @@ -530,7 +530,26 @@ public class ExperimentalEventHandler implements EventHandler { buildRunning = false; } stopUpdateThread(); - flushStdOutStdErrBuffers(); + synchronized (this) { + try { + // If a progress bar is currently present, clean it and redraw it. + boolean progressBarPresent = numLinesProgressBar > 0; + if (progressBarPresent) { + clearProgressBar(); + } + terminal.flush(); + boolean incompleteLine = flushStdOutStdErrBuffers(); + if (incompleteLine) { + crlf(); + } + if (progressBarPresent) { + addProgressBar(); + } + terminal.flush(); + } catch (IOException e) { + logger.warning("IO Error writing to output stream: " + e); + } + } } @Subscribe @@ -554,8 +573,7 @@ public class ExperimentalEventHandler implements EventHandler { synchronized (this) { buildRunning = true; } - stopUpdateThread(); - flushStdOutStdErrBuffers(); + completeBuild(); try { terminal.resetTerminal(); terminal.flush(); |