Closed famod closed 3 years ago
This seems to be related to TERM=xterm-256color
. Switching to TERM=xterm
seems to fix the problem.
But since we were facing Maven Surefire fork instabilities we stick to -Djansi.passthrough=true
which works for both xterm
and xterm-256color
.
@famod I'd like to investigate this issue. Jansi is suppose to handle those ansi sequences correctly.
The fact that it seems to work with TERM=xterm
and not TERM=xterm-256color
seems to point to this variable:
https://github.com/fusesource/jansi/blob/7e6bd5b2a5f10a32ec50e3d85b2c452328bdbac1/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java#L62-L65
It should be true if the terminal supports native colouring and if that was the case, the ansi sequences should be just passed through directly.
Could you check that the MSYSTEM
environment variable starts with MINGW
in your terminal ?
If that's the case, a simple fix would be
static final boolean IS_MINGW_XTERM = IS_WINDOWS
&& System.getenv("MSYSTEM") != null
&& System.getenv("MSYSTEM").startsWith("MINGW")
&& System.getenv("TERM") != null
&& System.getenv("TERM").startsWith("xterm");
@famod Fwiw, I've just installed git bash on Windows 10, and the TERM
env var ends up with xterm
, not xterm-256color
. Did you change that explicitly ?
@gnodet
It is actually xterm
when using Git Bash directly but I am using it within ConEmu.
ConEmu task definition looks like this:
cmd.exe -new_console:t:someproject-mw-dev -new_console:d:C:\Develop\someproject\middleware\_develop\someproject-middleware /K "call c:\Develop\someproject\_cmd\th-rel.cmd && call gitbash"
th-rel.cmd
just sets up JAVA_HOME etc. and gitbash
looks like this:
@"C:\Program Files\Git\git-cmd.exe" --no-cd --command=usr/bin/bash.exe -l -i
Currently TERM
is cygwin
when I start it this way (cygwin is also installed). It is the same on my private machine.
Could you check that the MSYSTEM environment variable starts with MINGW in your terminal ?
On both machines, directly in Git Bash but also when "wrapped" by ConEmu:
$ echo $MSYSTEM
MINGW64
the
TERM
env var ends up withxterm
, notxterm-256color
. Did you change that explicitly ?
I'm 99% sure that I did not change TERM myself.
Btw, on my business machine:
$ git --version
git version 2.26.2.windows.1
ConEmu 200615
ConEmu support has been added with https://github.com/fusesource/jansi/commit/2f866c4cf31b8ae44e005515326ad9b2819a394f but not released. I'll do a release soon to get the latest fixes out.
I was/am unable to get colorized output from Quarkus tests (via
maven-surefire-plugin
) because Jansi does not seem to support the rather complext color sequences, e.g.:It seems Jansi has trouble with the "38" sequence (forground color)?
Since I am using Git Bash on Windows 10, I tried adding
-Djansi.passthrough=true
toMAVEN_OPTS
and voila: It works!The OOTB experience would be much better though if colorized logging would just work right away.
PS: Maven 3.6.3 with Jasni 1.17.1 (also tried 1.18 but that didn't change anything).