-
Notifications
You must be signed in to change notification settings - Fork 13.3k
TERM=dumb is not respected for warnings in diagnostic annotations #50645
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
Comments
I think this might have been fixed in #49191. |
It appears to still be a problem in Rust Nightly at the time of writing this. I’m making the assumption here that #49191 is in Nightly? |
#49191 only changed the behavior of the bootstrap wrapper when building rust itself, so it's unrelated to this issue. |
Which version of Rust/OS are you using? I can't seem to reproduce this on macOS with either 1.26.0 or 1.27.0-nightly (acd3871 2018-05-10). |
The test case for this is that I’ve tested with the following rustc versions:
|
I ran some further tests and it appears the escape sequences only appear when the diagnostic output comes from a crate dependency. The warning above stems from the webdriver crate, which has an unused variant in an enum. |
… and apparently only for warnings. I’m trying to devise a test case. |
Sorry, I was a bit quick on the trigger in my previous comment. The colourisation appears to only happen for warnings. It is reproducible on Nightly with a program that the compiler will emit a warning for: pub fn foo() {
let bar = "42";
} I’ve put this program (along with the necessary cargo files) in a gist at https://gist.github.com/andreastt/498e3abe08a6a16123e99c02a77c2c73. Running it, I see the following output in a dumb terminal:
|
@sfackler You were entirely correct! I iteratively unset each environment variable listed by env(1) and found that Sorry for wasting your name, but you did help me narrow down the problem. |
No worries! |
It appears the
TERM=dumb
environment variable is not respected by librustc_errors’ diagnostic annotations for warnings, hints, fatal errors, et al.The below example of compiling a random program I’ve authored shows that the string “Compiling” correctly does not get colourised. This is because it uses termcolor’s
ColorChoice::Auto
which cancels colourisation because it checks if the terminal is dumb.Farther down in the example, the string starting with “warning” emits a lot of escape sequences for colourisation.
For reference, so-called “dumb terminals” are terminals that only recognise a limited subset of escape sequences. In my particular case it is the monochrome rc shell.
The text was updated successfully, but these errors were encountered: