mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-26 15:38:34 +00:00
Simplify reporting of terminal info
This commit is contained in:
@@ -35,8 +35,6 @@ import org.jboss.fuse.mvnd.common.Message.BuildStarted;
|
||||
import org.jboss.fuse.mvnd.common.OsUtils;
|
||||
import org.jboss.fuse.mvnd.common.logging.ClientOutput;
|
||||
import org.jboss.fuse.mvnd.common.logging.TerminalOutput;
|
||||
import org.jline.terminal.Terminal;
|
||||
import org.jline.terminal.impl.AbstractPosixTerminal;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -129,13 +127,7 @@ public class DefaultClient implements Client {
|
||||
.reset().toString();
|
||||
output.accept(null, v);
|
||||
// Print terminal information
|
||||
Terminal terminal = output.getTerminal();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Terminal: ").append(terminal != null ? terminal.getClass().getName() : null);
|
||||
if (terminal instanceof AbstractPosixTerminal) {
|
||||
sb.append(" with pty ").append(((AbstractPosixTerminal) terminal).getPty().getClass().getName());
|
||||
}
|
||||
output.accept(null, sb.toString());
|
||||
output.describeTerminal();
|
||||
/*
|
||||
* Do not return, rather pass -v to the server so that the client module does not need to depend on any
|
||||
* Maven artifacts
|
||||
|
@@ -15,15 +15,11 @@
|
||||
*/
|
||||
package org.jboss.fuse.mvnd.common.logging;
|
||||
|
||||
import org.jline.terminal.Terminal;
|
||||
|
||||
/**
|
||||
* A sink for various kinds of events sent by the daemon.
|
||||
*/
|
||||
public interface ClientOutput extends AutoCloseable {
|
||||
|
||||
Terminal getTerminal();
|
||||
|
||||
void startBuild(String name, int projects, int cores);
|
||||
|
||||
void projectStateChanged(String projectId, String display);
|
||||
@@ -41,4 +37,6 @@ public interface ClientOutput extends AutoCloseable {
|
||||
void display(String projectId, String message);
|
||||
|
||||
String prompt(String projectId, String message, boolean password);
|
||||
|
||||
void describeTerminal();
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@ import java.util.stream.Collectors;
|
||||
import org.jline.terminal.Size;
|
||||
import org.jline.terminal.Terminal;
|
||||
import org.jline.terminal.TerminalBuilder;
|
||||
import org.jline.terminal.impl.AbstractPosixTerminal;
|
||||
import org.jline.utils.AttributedString;
|
||||
import org.jline.utils.AttributedStringBuilder;
|
||||
import org.jline.utils.AttributedStyle;
|
||||
@@ -138,10 +139,6 @@ public class TerminalOutput implements ClientOutput {
|
||||
this.reader = r;
|
||||
}
|
||||
|
||||
public Terminal getTerminal() {
|
||||
return terminal;
|
||||
}
|
||||
|
||||
public void startBuild(String name, int projects, int cores) {
|
||||
this.name = name;
|
||||
this.totalProjects = projects;
|
||||
@@ -238,6 +235,16 @@ public class TerminalOutput implements ClientOutput {
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTerminal() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Terminal: ").append(terminal != null ? terminal.getClass().getName() : null);
|
||||
if (terminal instanceof AbstractPosixTerminal) {
|
||||
sb.append(" with pty ").append(((AbstractPosixTerminal) terminal).getPty().getClass().getName());
|
||||
}
|
||||
this.accept(null, sb.toString());
|
||||
}
|
||||
|
||||
void readInputLoop() {
|
||||
try {
|
||||
while (!closing) {
|
||||
|
Reference in New Issue
Block a user