fix AnsiLog static init may error. #2740

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

@ -53,6 +53,7 @@ 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 {
try {
if (System.console() != null) { if (System.console() != null) {
enableColor = true; enableColor = true;
// windows dos, do not support color // windows dos, do not support color
@ -64,6 +65,9 @@ public abstract class AnsiLog {
if (OSUtils.isCygwinOrMinGW()) { if (OSUtils.isCygwinOrMinGW()) {
enableColor = true; enableColor = true;
} }
} catch (Throwable t) {
// ignore
}
} }
private AnsiLog() { private AnsiLog() {

Loading…
Cancel
Save