Merge pull request #151 from gnodet/issue-36

Fix windows terminal issues
This commit is contained in:
Guillaume Nodet
2020-10-26 22:25:11 +01:00
committed by GitHub
5 changed files with 21 additions and 1 deletions

View File

@@ -121,6 +121,7 @@
--allow-incomplete-classpath
-H:IncludeResources=org/jboss/fuse/mvnd/.*
-H:IncludeResources=org/jline/utils/.*
-H:IncludeResources=org/fusesource/jansi/jansi.properties
</buildArgs>
</configuration>
</plugin>

View File

@@ -39,6 +39,8 @@ import org.jboss.fuse.mvnd.common.Message.KeepAliveMessage;
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;
@@ -121,6 +123,7 @@ public class DefaultClient implements Client {
// Print version if needed
if (version || showVersion || debug) {
// Print mvnd version
final String nativeSuffix = Environment.isNative() ? " (native)" : "";
final String v = Ansi.ansi().bold().a(
"Maven Daemon "
@@ -130,6 +133,14 @@ public class DefaultClient implements Client {
+ nativeSuffix)
.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());
/*
* Do not return, rather pass -v to the server so that the client module does not need to depend on any
* Maven artifacts

View File

@@ -15,11 +15,15 @@
*/
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);

View File

@@ -117,6 +117,10 @@ 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;

View File

@@ -40,7 +40,7 @@
<graalvm.version>20.2.0</graalvm.version>
<groovy.version>3.0.0</groovy.version>
<jakarta.inject.version>1.0</jakarta.inject.version>
<jline.version>3.12.1</jline.version>
<jline.version>3.17.0</jline.version>
<junit.jupiter.version>5.6.0</junit.jupiter.version>
<logback.version>1.2.3</logback.version>
<maven.version>3.6.3</maven.version>