mirror of https://github.com/apache/maven.git
Fix terminal usage in mvnd (#1486)
mvnd needs to set its own terminal, so we need to open the door for that
This commit is contained in:
parent
854589b131
commit
8d6bf5f033
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.maven.jline;
|
package org.apache.maven.jline;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
|
||||||
|
|
||||||
import org.apache.maven.api.services.MessageBuilder;
|
import org.apache.maven.api.services.MessageBuilder;
|
||||||
import org.apache.maven.api.services.MessageBuilderFactory;
|
import org.apache.maven.api.services.MessageBuilderFactory;
|
||||||
import org.jline.jansi.AnsiConsole;
|
import org.jline.jansi.AnsiConsole;
|
||||||
|
@ -37,18 +35,24 @@ public class MessageUtils {
|
||||||
static Thread shutdownHook;
|
static Thread shutdownHook;
|
||||||
static final Object STARTUP_SHUTDOWN_MONITOR = new Object();
|
static final Object STARTUP_SHUTDOWN_MONITOR = new Object();
|
||||||
|
|
||||||
static PrintStream prevOut;
|
public static void systemInstall(Terminal terminal) {
|
||||||
static PrintStream prevErr;
|
MessageUtils.terminal = terminal;
|
||||||
|
MessageUtils.reader = createReader(terminal);
|
||||||
|
}
|
||||||
|
|
||||||
public static void systemInstall() {
|
public static void systemInstall() {
|
||||||
terminal = new FastTerminal(
|
MessageUtils.terminal = new FastTerminal(
|
||||||
() -> TerminalBuilder.builder().name("Maven").dumb(true).build(), t -> {
|
() -> TerminalBuilder.builder().name("Maven").dumb(true).build(), terminal -> {
|
||||||
reader = LineReaderBuilder.builder().terminal(t).build();
|
MessageUtils.reader = createReader(terminal);
|
||||||
AnsiConsole.setTerminal(t);
|
AnsiConsole.setTerminal(terminal);
|
||||||
AnsiConsole.systemInstall();
|
AnsiConsole.systemInstall();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static LineReader createReader(Terminal terminal) {
|
||||||
|
return LineReaderBuilder.builder().terminal(terminal).build();
|
||||||
|
}
|
||||||
|
|
||||||
public static void registerShutdownHook() {
|
public static void registerShutdownHook() {
|
||||||
if (shutdownHook == null) {
|
if (shutdownHook == null) {
|
||||||
shutdownHook = new Thread(() -> {
|
shutdownHook = new Thread(() -> {
|
||||||
|
|
Loading…
Reference in New Issue