From a082c3cdf8177602416a6b40fadd2cf6d10fd1d7 Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Fri, 9 Nov 2018 01:37:42 +0800 Subject: [PATCH] TelnetConsole support mingw/cygw color mode. #278 --- .../main/java/com/taobao/arthas/client/TelnetConsole.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/src/main/java/com/taobao/arthas/client/TelnetConsole.java b/client/src/main/java/com/taobao/arthas/client/TelnetConsole.java index 6f1fddd8..053550f2 100644 --- a/client/src/main/java/com/taobao/arthas/client/TelnetConsole.java +++ b/client/src/main/java/com/taobao/arthas/client/TelnetConsole.java @@ -151,6 +151,14 @@ public class TelnetConsole { } public static void main(String[] args) throws IOException { + // support mingw/cygw jline color + if (System.getProperty("os.name").startsWith("Windows")) { + if ((System.getenv("MSYSTEM") != null && System.getenv("MSYSTEM").startsWith("MINGW")) + || "/bin/shell".equals(System.getenv("SHELL"))) { + System.setProperty("jline.terminal", System.getProperty("jline.terminal", "jline.UnixTerminal")); + } + } + TelnetConsole telnetConsole = new TelnetConsole(); CLI cli = CLIConfigurator.define(TelnetConsole.class);