-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strictly speaking this method does not check for Cygwin (as it e.g. does not check to be on Windows) but only for XTerm (which in conjunction with being on Windows is a sign of running under Cygwin). Simplify the code a bit to get rid of the explicit null check long the way.
- Loading branch information
1 parent
a54d2b5
commit 25ed28f
Showing
1 changed file
with
4 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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")); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sschuberth
Author
Contributor
|
||
} | ||
|
||
/** | ||
|
What about
xterm-color
? It would fail here.