-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Error message colouring broken (on Windows) with 1.74 #13104
Comments
It is so old that I don't see that it can be relevant, but this existing issue: rust-lang/rust#49322 was similar |
Thanks for the report! It would be super useful if you could bisect this regression using the cargo-bisect-rustc tool! |
That was relatively painless, once I'd figured out the Windows specific nuances and turned off AVG!? searched nightlies: from nightly-2023-08-20 to nightly-2023-10-01 bisected with cargo-bisect-rustc v0.6.7Host triple: x86_64-pc-windows-msvc cargo bisect-rustc --start=1.73.0 --end=1.74.0 It might be worth noting that the output from the bisect tool was littered with ANSI control sequences so it looks like anstream doesn't work as intended on my Windows 10. |
thank you very much! this looks like a cargo issue then, @weihanglo could you move the issue? |
Transferred. Haven't yet investigated but is very like due to this PR #12751. |
So if I understood this correctly, cargo is correctly colored when it is directly printing something but not when its taking the colored output from rustc and printing that. ... that is odd because it should all be going through the same code path. I'll likely not be able to dig into this until monday |
I can confirm that if I use rustc directly then the output is correctly coloured |
I tested From wikipedia, it sounds like Windows 10 version 1511 is the first version with ANSI escape codes. Huh, for some reason I thought this was back in the Windows 8 days Can you confirm what version of Windows you are using? To better understand the scope of the problem, how come you are on such an old build of Windows 10? If this is a pre-1511 build of Windows, then that means |
@StevePitts could you run the following and report the results? $ git clone https://github.com/rust-cli/anstyle.git
$ cd anstyle
$ cargo run -p anstyle-query --example query
$ cargo run -p anstyle-wincon --example dump-wincon
$ cargo run -p anstream --example query-stream
$ cargo run -p anstream --example dump-stream |
For example, on my Windows 10 machine $ cargo run -p anstyle-query --example query
clicolor: None
clicolor_force: false
no_color: false
term_supports_ansi_color: false
term_supports_color: true
truecolor: false
enable_ansi_colors: Some(true)
is_ci: false
$ cargo run -p anstyle-wincon --example dump-wincon
... first two rows are colored, rest are not
$ cargo run -p anstream --example query-stream
stdout:
choice: Always
choice: AlwaysAnsi
stderr:
choice: Always
choice: AlwaysAnsi
$ cargo run -p anstream --example dump-stream
... all rows colored |
Sorry for the delayed response folks but I've been in Zurich for work since Sunday night with no access to my home development box. According to Take Command my Windows is: Windows 10 [Version 10.0.19045.3693] and as far as I'm concerned is bang up to date. Results from a Take Command window: Results from a cmd.exe window: I hope this helps but I'm unlikely to be of much help for a few days as I'm returned from Zurich and tested positive for COVID |
Hope you get better quickly! |
There are two questions here
|
In debugging this, I found that rustc is correctly emitting the escape codes. Most likely what is happening is that Example of escape codes it can handle
Example of escape codes it can't handle
|
|
In addition to re-running |
fix: Print rustc messages colored on wincon ### What does this PR try to resolve? The real fix is over in rust-cli/anstyle#150; this just upgrades to it Fixes #13104 ### How should we test and review this PR? I hacked vt console support off, ran a build before and rustc messages weren't colored. Now with this change, rustc messages are colored. ### Additional information This still doesn't address why wincon is being used on their system
@epage not sure if this is still required given that the issue has been closed but: HTH |
Thanks @StevePitts ! Basically, this bug is actually two and we solved the more immediate one but it would also be good to figure out why we have to fallback to wincon on your system. The running assumption has been that wincon support is only needed for legacy Win8 systems and there has been discussion on whether it should be removed. Understanding why cargo is falling back to wincon on your system can help us withe either
So ripgrep is running into the same problem with its different Some random notesThe docs for
but we only Though the example doesn't do anything with this. The error being returned is The docs say:
A stackoverflow post references "legacy console". It looks like this is a "Properties" setting. Can you check if "legacy console" is enabled?
|
A few things of note:
On the basis of the above is there anything more you'd like me to investigate here? |
Thats it; thanks! |
After upgrading to Rust 1.74.0 some of the message colouring and highlighting disappears when cargo or rustc are used in a Windows 10 console session (Take Command, cmd.exe and Powershell all exhibit the same behaviour):
As the above image demonstrates this was working fine with 1.73.0
The text was updated successfully, but these errors were encountered: