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

Gtest's output has no color when running in kitty #3455

Closed
ItsNilDev opened this issue Jun 23, 2021 · 5 comments · Fixed by #4058
Closed

Gtest's output has no color when running in kitty #3455

ItsNilDev opened this issue Jun 23, 2021 · 5 comments · Fixed by #4058

Comments

@ItsNilDev
Copy link

ItsNilDev commented Jun 23, 2021

Describe the bug
when I compiled the test.cpp file with g++ test.cpp -lgtest, the output of that has no color when I ran it with ./a.out (on kitty) but it does have color when running in konsole. Kitty itself can show colors in the terminal. I tested with -fdiagnostics-color=always too but I had no luck.

Steps to reproduce the bug
compile the program.
run it in kitty.

What operating system and version are you using?
Latest Arch linux with Linux 5.10.43-1-lts

What compiler and version are you using?

COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-werror gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (GCC) 
@ItsNilDev ItsNilDev added the bug label Jun 23, 2021
@derekmauro
Copy link
Member

Thank you for reporting this. This isn't something we are likely to fix ourselves, but it can probably fixed with a simple PR. We would accept such a request.

@ItsNilDev
Copy link
Author

ItsNilDev commented Jun 29, 2021

You're basically asking me to fix this myself, I have no idea what's going on, on this repo.
So I guess I can not fix this.

@glsscnnn
Copy link

Interesting, this probably has to do with the way kitty handles the output, because other terminals work fine, I tested on kitty and it's bugged for some reason.

How to solve this is probably

  1. determine the terminal is kitty
  2. output the test differently because kitty doesn't handle the colors correctly?

idk seems mostly like kitty is probably bugged here.

@lekcyjna123
Copy link

lekcyjna123 commented Jan 2, 2022

Hi,
kitty work fine with coloring output, after change TERM variable or using --gtest_color=yes. By default kitty use:

TERM=xterm-kitty

And in such case to have colored output from gtest we have to use --gtest_color=yes.

To have it working with --gtest_color=auto tests should be run with different TERM variable:

TERM=xterm-256color ./gtestTest

EDIT:

Here is fragment of google test advanced manual (described by kovidgoyal/kitty#4400 (comment))

You can set the GTEST_COLOR environment variable or the --gtest_color command line flag to yes, no, or auto (the default) to enable colors, disable colors, or let googletest decide. When the value is auto, googletest will use colors if and only if the output goes to a terminal and (on non-Windows platforms) the TERM environment variable is set to xterm or xterm-color.

So i suppose that to fix issue with gtest there should be changed --gtest_color=auto behaviour. What do you think about checking COLORTERM variable?

@ghost ghost mentioned this issue Nov 10, 2022
@vmiheer
Copy link

vmiheer commented Aug 28, 2023

Similar issue with Alacritty. I wonder if better (non-standard) option is to depend on COLORTERM environment variable similar to how emacs does? There is long thread about pros/cons of COLORTERM in windows terminal discussion but the argument is on same line as why cmake is defacto build system for c++ (loads of projects use it).

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

Successfully merging a pull request may close this issue.

5 participants