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

Colourised output even when TERM=dumb #360

Closed
ijackson opened this issue Aug 27, 2024 · 4 comments · Fixed by #362
Closed

Colourised output even when TERM=dumb #360

ijackson opened this issue Aug 27, 2024 · 4 comments · Fixed by #362

Comments

@ijackson
Copy link

When running trycmd in an environment without a graphical terminal (for example, an emacs M-x compile window) trycmd still produces colourised output.

trycmd should look at TERM to decide whether to colourise the output. At the very least, if TERM=dumb it should avoid sending control codes.

CC @gabi-250 (since this is related to use of trycmd in Arti's tests)

@epage
Copy link
Contributor

epage commented Aug 27, 2024

Could you provide reproduction steps? We should be checking TERM=dumb

@ijackson
Copy link
Author

ijackson commented Aug 27, 2024

Steps

(not minimised, sorry)

git clone https://gitlab.torproject.org/tpo/core/arti.git
cd arti
git checkout  5e2d5532d002c9df9a4cf6d83cdbe7d6125bc4be
perl -i~ -pe 's/flamingo is not configured/XXXX/' crates/arti/tests/testcases/hss/hss.md
TERM=xterm cargo test --locked --offline -p arti --all-features -- cli_tests
TERM=dumb cargo test --locked --offline -p arti --all-features -- cli_tests

Expected output

  1. Error report containing coloured output
  2. Error report containing plain text output

Actual output

Two error reports with coloured output, including in overview report, and coloured diff.

Discussion

I may be confused, but during my testing they appeared to be influenced by previous runs. Hence the two step process above.

I can see the colour escape sequences if I add 2>&1 | cat -vet

@epage
Copy link
Contributor

epage commented Aug 27, 2024

$ git checkout 3957a384aca2cef964e86ba9ad48d98c6f4cf0dc 

I got an error that that commit wasn't in my tree

@ijackson
Copy link
Author

I got an error that that commit wasn't in my tree

Sorry about that. Fixed it, please use 5e2d5532d002c9df9a4cf6d83cdbe7d6125bc4be (if you still need it...)

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

Successfully merging a pull request may close this issue.

2 participants