Skip to content

Commit

Permalink
Fix final output
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Nov 9, 2020
1 parent fe2125c commit 375c3bd
Showing 1 changed file with 12 additions and 9 deletions.
Expand Up @@ -107,20 +107,24 @@ public TerminalOutput(Path logFile) throws IOException {
@Override
public void accept(Message entry) {
assert "main".equals(Thread.currentThread().getName());
doAccept(entry);
update();
if (doAccept(entry)) {
update();
}
}

@Override
public void accept(List<Message> entries) {
assert "main".equals(Thread.currentThread().getName());
boolean update = true;
for (Message entry : entries) {
doAccept(entry);
update &= doAccept(entry);
}
if (update) {
update();
}
update();
}

private void doAccept(Message entry) {
private boolean doAccept(Message entry) {
switch (entry.getType()) {
case Message.BUILD_STARTED: {
BuildStarted bs = (BuildStarted) entry;
Expand All @@ -147,7 +151,7 @@ private void doAccept(Message entry) {
final AttributedStyle s = new AttributedStyle().bold().foreground(AttributedStyle.RED);
new AttributedString(msg, s).println(terminal);
terminal.flush();
return;
return false;
}
case Message.PROJECT_STARTED:
case Message.MOJO_STARTED: {
Expand Down Expand Up @@ -180,7 +184,7 @@ private void doAccept(Message entry) {
} finally {
terminal.flush();
}
return;
return false;
}
case Message.KEEP_ALIVE: {
break;
Expand All @@ -193,7 +197,6 @@ private void doAccept(Message entry) {
}
case Message.PROMPT: {
Message.Prompt prompt = (Message.Prompt) entry;

readInput.writeLock().lock();
try {
display.update(Collections.emptyList(), 0);
Expand Down Expand Up @@ -265,7 +268,7 @@ private void doAccept(Message entry) {
}
break;
}

return true;
}

@Override
Expand Down

0 comments on commit 375c3bd

Please sign in to comment.