Fixed jANSI segfaulting the JVM when there is no console

This commit is contained in:
RaphiMC 2023-09-12 18:09:09 +02:00
parent 59e9aa708d
commit 8baa02ec40
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94

View File

@ -36,7 +36,9 @@ public class Logger {
public static final PrintStream SYSERR = System.err;
public static void setup() {
AnsiConsole.systemInstall();
if (System.console() != null) { // jANSI is the best lib. If there is no console it just segfaults the JVM process. Thanks!
AnsiConsole.systemInstall();
}
System.setErr(new LoggerPrintStream("STDERR", SYSERR));
System.setOut(new LoggerPrintStream("STDOUT", SYSOUT));
}