io.quarkus.dev.console.TerminalUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-development-mode-spi Show documentation
Show all versions of quarkus-development-mode-spi Show documentation
SPI classes for Quarkus Development mode.
package io.quarkus.dev.console;
import java.io.Console;
import java.util.logging.Level;
import java.util.logging.Logger;
public class TerminalUtils {
private static final Logger LOGGER = Logger.getLogger(TerminalUtils.class.getName());
public static boolean isTerminal(Console console) {
if (console == null) {
return false;
}
if (Runtime.version().feature() < 22) { // isTerminal was introduced in Java 22
return true;
}
try {
return (boolean) Console.class.getMethod("isTerminal").invoke(console);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to invoke System.console().isTerminal() via Reflection API", e);
return false;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy