Skip to content

Commit

Permalink
fix AnsiLog static init may error. #2740
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyunabc committed Nov 28, 2023
1 parent 9a370d9 commit 7a72221
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions common/src/main/java/com/taobao/arthas/common/AnsiLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,20 @@ public abstract class AnsiLog {
private static final String ERROR_COLOR_PREFIX = "[" + colorStr("ERROR", RED) + "] ";

static {
if (System.console() != null) {
enableColor = true;
// windows dos, do not support color
if (OSUtils.isWindows()) {
enableColor = false;
try {
if (System.console() != null) {
enableColor = true;
// windows dos, do not support color
if (OSUtils.isWindows()) {
enableColor = false;
}
}
}
// cygwin and mingw support color
if (OSUtils.isCygwinOrMinGW()) {
enableColor = true;
// cygwin and mingw support color
if (OSUtils.isCygwinOrMinGW()) {
enableColor = true;
}
} catch (Throwable t) {
// ignore
}
}

Expand Down

0 comments on commit 7a72221

Please sign in to comment.