Skip to content

Commit 09722b7

Browse files
committed
Disable colors when running inside emacs without comint, fixes #205
1 parent e019a75 commit 09722b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/org/fusesource/jansi/AnsiConsole.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ private static AnsiPrintStream ansiStream(boolean stdout) {
247247
// If we can detect that stdout is not a tty.. then setup
248248
// to strip the ANSI sequences..
249249
isAtty = isatty(fd) != 0;
250+
String term = System.getenv("TERM");
251+
String emacs = System.getenv("INSIDE_EMACS");
252+
if (isAtty && "dumb".equals(term) && emacs != null && !emacs.contains("comint")) {
253+
isAtty = false;
254+
}
250255
withException = false;
251256
} catch (Throwable ignore) {
252257
// These errors happen if the JNI lib is not available for your platform.

0 commit comments

Comments
 (0)