Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jline3 example missing AnsiConsole.systemUninstall() #1165

Closed
dwalluck opened this issue Sep 8, 2020 · 1 comment
Closed

jline3 example missing AnsiConsole.systemUninstall() #1165

dwalluck opened this issue Sep 8, 2020 · 1 comment

Comments

@dwalluck
Copy link
Contributor

dwalluck commented Sep 8, 2020

performs systemInstall(), but not systemUninstall().

However, from

if (isWindows && !Ansi.AUTO.enabled()) {
I have to question whether these lines are even necessary anymore on anything other than Windows. And Windows 10 I believe has native ANSI support.

In fact, I had recently tried the logback feature that enabled ANSIConsole <withJansi>true</withJansi> and it just seemed to break the output under Cygwin rather than help.

Do you happen to know if it's safe to just leave these lines out entirely? Should we still be using them, but make it conditional on some Windows version? In most cases, I think we would try to place the uninstall in a finally block to make sure it is called (as I think an improper uninstall may mess up the I/O streams for future calls).

@remkop
Copy link
Owner

remkop commented Sep 8, 2020

Good catch!
I went ahead and fixed the example and the README (in a finally block).

Windows 10 does have native ANSI support, but "it's complicated" and it is switched off unless the application does something special. java does not do this "something special", so we don't get to enjoy this...

So, practically speaking, on Windows, using Jansi to get colors is the most reliable method.

I am not aware of any issues with the Cygwin/Jansi combination. If you have links or more info I can take a look.

Making this conditional for Windows-only is not a bad idea. In fact, that is what picocli-jansi-graalvm does, see this example.
I am not sure if JLine3 can be used to create GraalVM native images (although I think the Micronaut native CLI may be using JLine, not sure which version), so I had not thought to point to picocli-jansi-graalvm instead of plain Jansi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants