cygwin shows wrong brackets

Viewed 908

Hi I installed cygwin version 3.1.5 on a Win10 mashine. When I use maven for example then the output is not really correct. The square brackets are shown in a wrong way. Here an example

[?[1;34mINFO?[m] ?[1m------------------------------------------------------------------------?[m
[?[1;34mINFO?[m] ?[1;32mBUILD SUCCESS?[m
[?[1;34mINFO?[m] ?[1m------------------------------------------------------------------------?[m
[?[1;34mINFO?[m] Total time:  2:42 min
[?[1;34mINFO?[m] Finished at: 2020-06-10T15:26:07+02:00
[?[1;34mINFO?[m] ?[1m------------------------------------------------------------------------?[m

I can't figure out if this could be a locale problem because I don't understand how to change it and if it is really there the problem. Have someone of you some tips?

UPDATE -11.06.2020:

I found that probably the maven version could be the problem. For me this sounds strange. I run maven version 3.6.3: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000687110-Using-Mingw-as-terminal-doesn-t-display-ANSI-colors-in-Maven-output

Thanks a lot

5 Answers

check your TERM environment property and ensure it is set to "cygwin". For example,

TERM="cygwin"; export TERM

as suggested here https://stackoverflow.com/a/62971169 on cygwin if you pipe the output to a tee it works!!!

you can alias the mvn command with a function with something like:

function mvn() {  $M2_HOME/bin/mvn $@ | tee }

inside your .bash_profile or .bash_alias

At the end the solution for me was:

I put the cygwin path in the PATH variable.

Now I don't run anymore the cygwin itself, but I have directly the functionlities when i start cmd.exe

I ran into the same problem when using Maven 3.6.3 with Cygwin.

This is a problem of a Maven 3rd library: Jansi.

Maven 3.6.3 uses Jansi 1.1.17 but support for Cygwin was added with Jansi 1.1.18. See this Jansi bug and this Jansi commit.

I came to this conclusion after reading the following web page and looking into Maven and Jansi code.

Maybe we can convince the Maven guys somehow to switch to the newer Jansi lib :)

Maybe not a definitive answer, but if you pipe everything to egrep, the colors will come back.

mvn clean install | egrep ".*"
Related