diff --git a/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java b/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java index 31b6b50c..3d16cfec 100644 --- a/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java +++ b/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java @@ -85,7 +85,7 @@ public static OutputStream wrapOutputStream(final OutputStream stream, int filen } String os = System.getProperty("os.name"); - if (os.startsWith("Windows") && !isCygwin()) { + if (os.startsWith("Windows") && !isXterm()) { // On windows we know the console does not interpret ANSI codes.. try { @@ -107,7 +107,7 @@ public static OutputStream wrapOutputStream(final OutputStream stream, int filen // If we can detect that stdout is not a tty.. then setup // to strip the ANSI sequences.. int rc = isatty(fileno); - if (!isCygwin() && !forceColored && rc == 0) { + if (!isXterm() && !forceColored && rc == 0) { return new AnsiOutputStream(stream); } @@ -129,9 +129,8 @@ public void close() throws IOException { }; } - private static boolean isCygwin() { - String term = System.getenv("TERM"); - return term != null && term.equals("xterm"); + private static boolean isXterm() { + return "xterm".equals(System.getenv("TERM")); } /**