Skip to content

Commit

Permalink
#119 detect Git bash with TERM=xterm since BASH is not visible
Browse files Browse the repository at this point in the history
  • Loading branch information
hboutemy committed Apr 14, 2018
1 parent abe94bf commit 1a77e3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion jansi/src/main/java/org/fusesource/jansi/AnsiMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1a77e3c

Please sign in to comment.