Skip to content

Commit

Permalink
Disable colors when running inside emacs without comint, fixes #205
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jul 23, 2021
1 parent e019a75 commit 09722b7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/fusesource/jansi/AnsiConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ private static AnsiPrintStream ansiStream(boolean stdout) {
// If we can detect that stdout is not a tty.. then setup
// to strip the ANSI sequences..
isAtty = isatty(fd) != 0;
String term = System.getenv("TERM");
String emacs = System.getenv("INSIDE_EMACS");
if (isAtty && "dumb".equals(term) && emacs != null && !emacs.contains("comint")) {
isAtty = false;
}
withException = false;
} catch (Throwable ignore) {
// These errors happen if the JNI lib is not available for your platform.
Expand Down

0 comments on commit 09722b7

Please sign in to comment.