From 1a77e3cb816ff366e6ec811c3fb27a36a5a72916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sat, 14 Apr 2018 17:56:25 +0200 Subject: [PATCH] #119 detect Git bash with TERM=xterm since BASH is not visible --- jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java | 8 ++++---- jansi/src/main/java/org/fusesource/jansi/AnsiMain.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java b/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java index b2ed7426..10709856 100644 --- a/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java +++ b/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java @@ -48,10 +48,10 @@ public class AnsiConsole { && System.getenv("PWD").startsWith("/") && !"cygwin".equals(System.getenv("TERM")); - static final boolean IS_MINGW_BASH = IS_WINDOWS + static final boolean IS_MINGW_XTERM = IS_WINDOWS && System.getenv("MSYSTEM") != null && System.getenv("MSYSTEM").startsWith("MINGW") - && System.getenv("BASH") != null; + && "xterm".equals(System.getenv("TERM")); private static JansiOutputType jansiOutputType; static final JansiOutputType JANSI_STDOUT_TYPE; @@ -119,7 +119,7 @@ public static OutputStream wrapOutputStream(final OutputStream stream, int filen return new AnsiOutputStream(stream); } - if (IS_WINDOWS && !IS_CYGWIN && !IS_MINGW_BASH) { + if (IS_WINDOWS && !IS_CYGWIN && !IS_MINGW_XTERM) { // On windows we know the console does not interpret ANSI codes.. try { @@ -197,7 +197,7 @@ public static PrintStream wrapPrintStream(final PrintStream ps, int fileno) { return new AnsiPrintStream(ps); } - if (IS_WINDOWS && !IS_CYGWIN && !IS_MINGW_BASH) { + if (IS_WINDOWS && !IS_CYGWIN && !IS_MINGW_XTERM) { // On windows we know the console does not interpret ANSI codes.. try { diff --git a/jansi/src/main/java/org/fusesource/jansi/AnsiMain.java b/jansi/src/main/java/org/fusesource/jansi/AnsiMain.java index 59bf0ce1..04239344 100644 --- a/jansi/src/main/java/org/fusesource/jansi/AnsiMain.java +++ b/jansi/src/main/java/org/fusesource/jansi/AnsiMain.java @@ -74,7 +74,7 @@ public static void main(String... args) throws IOException { System.out.println("IS_WINDOWS: " + AnsiConsole.IS_WINDOWS); if (AnsiConsole.IS_WINDOWS) { System.out.println("IS_CYGWIN: " + AnsiConsole.IS_CYGWIN); - System.out.println("IS_MINGW_BASH: " + AnsiConsole.IS_MINGW_BASH); + System.out.println("IS_MINGW_XTERM: " + AnsiConsole.IS_MINGW_XTERM); } System.out.println();