Skip to content

Commit

Permalink
Merge pull request apache#151 from gnodet/issue-36
Browse files Browse the repository at this point in the history
Fix windows terminal issues
  • Loading branch information
gnodet authored Oct 26, 2020
2 parents b46d5b9 + 433d414 commit 4cec95e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
11 changes: 11 additions & 0 deletions client/src/main/java/org/jboss/fuse/mvnd/client/DefaultClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
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;

Expand Down Expand Up @@ -121,6 +123,7 @@ public ExecutionResult execute(ClientOutput output, List<String> argv) {

// 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 "
Expand All @@ -130,6 +133,14 @@ public ExecutionResult execute(ClientOutput output, List<String> argv) {
+ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ public TerminalOutput(Path logFile) throws IOException {
this.reader = r;
}

public Terminal getTerminal() {
return terminal;
}

public void startBuild(String name, int projects, int cores) {
this.name = name;
this.totalProjects = projects;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 4cec95e

Please sign in to comment.