Skip to content

Picocli Jansi GraalVM 1.2.0

Latest
Compare
Choose a tag to compare
@remkop remkop released this 04 Jul 05:23

1.2.0 - Support org.fusesource.jansi.Ansi.disable property

This release adds support for the org.fusesource.jansi.Ansi.disable system property: if this property exists and is equal to, ignoring case, the string "true", then no Jansi classes will be loaded.

The use of Jansi may cause problems for applications when running in some restricted Windows environments.
The problem is that AppLocker can forbid loading of non-signed libraries from the Windows temporary folder.

Jansi extracts a dll to the temporary folder of Windows as soon as one of its class is loaded, like when the org.fusesource.jansi.AnsiConsole::systemInstall method is called.

With this version of picocli-jansi-graalvm, applications can safely use the picocli.jansi.graalvm.AnsiConsole::windowsInstall method as below:

public static void main(String[] args) {
    // only loads Jansi classes if `org.fusesource.jansi.Ansi.disable` is not true
    try (AnsiConsole ansi = AnsiConsole.windowsInstall()) { // enable colors on Windows
        new CommandLine(new MyApp()).execute(args);
    }          // Closeable does cleanup when done
}

This internally checks the value of the org.fusesource.jansi.Ansi.disable system property before calling the org.fusesource.jansi.AnsiConsole::systemInstall method

End users can use this system property to use the application with reduced functionality, rather than being prevented from using the application altogether.