fusesource / jansi

Jansi is a small java library that allows you to use ANSI escape sequences to format your console output which works even on windows.
http://fusesource.github.io/jansi/
Apache License 2.0
1.12k stars 139 forks source link

MINGW support requires --add-opens java.base/java.lang=ALL-UNNAMED #290

Open rosti-il opened 4 months ago

rosti-il commented 4 months ago

This message is printed by Jansi 2.4.1 when I run Maven 3.9.8 that uses it as one of its libraries. Also if I just run java -jar jansi-2.4.1.jar in Git Bash of Git for Windows 2.45.2.windows.1 this is what I see in the lines it prints out:

MINGW support requires --add-opens java.base/java.lang=ALL-UNNAMED
isatty(STDOUT_FILENO): 0, System.out is *NOT* a terminal
width(STDOUT_FILENO): 0
MINGW support requires --add-opens java.base/java.lang=ALL-UNNAMED
isatty(STDERR_FILENO): 0, System.err is *NOT* a terminal
width(STDERR_FILENO): 0
MINGW support requires --add-opens java.base/java.lang=ALL-UNNAMED
MINGW support requires --add-opens java.base/java.lang=ALL-UNNAMED

As you can see it still can't recognize System.out and System.err as terminals and still can't find the terminal width. Tried with Java 17 and 22 from Oracle.

The code that prints that "MINGW support requires" message was introduced in #264 as a fix of #233 I decided to rework it and made it right and simpler. Please see my pull request that I will make shortly after opening this bug report.

rosti-il commented 4 months ago

Pull Request is #291 Please review and merge it.

That version works properly on both Git Bash and Window 10 CMD and contains following lines printed out:

isatty(STDOUT_FILENO): 1, System.out is a terminal
width(STDOUT_FILENO): 140
isatty(STDERR_FILENO): 1, System.err is a terminal
width(STDERR_FILENO): 140

If I change width of the Mintty window of Git Bash and rerun, the printed width is properly changed appropriately.