fix AnsiLog static init may error. #2740

pull/2746/head
hengyunabc 1 year ago
parent 9a370d9d8a
commit 7a722217ab

@ -53,16 +53,20 @@ public abstract class AnsiLog {
private static final String ERROR_COLOR_PREFIX = "[" + colorStr("ERROR", RED) + "] "; private static final String ERROR_COLOR_PREFIX = "[" + colorStr("ERROR", RED) + "] ";
static { static {
if (System.console() != null) { try {
enableColor = true; if (System.console() != null) {
// windows dos, do not support color enableColor = true;
if (OSUtils.isWindows()) { // windows dos, do not support color
enableColor = false; if (OSUtils.isWindows()) {
enableColor = false;
}
} }
} // cygwin and mingw support color
// cygwin and mingw support color if (OSUtils.isCygwinOrMinGW()) {
if (OSUtils.isCygwinOrMinGW()) { enableColor = true;
enableColor = true; }
} catch (Throwable t) {
// ignore
} }
} }

Loading…
Cancel
Save