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
Fix ANSI colors in Windows CMD and PowerShell #28
Conversation
@Phundrak seems like we have to bump the minimum Rust version with those new dependencies. Can you tell me the lowest Rust version this still compiles with? Thx. |
Oh and is it possible to pull those dependencies only, when compiling for windows? |
I had a look at your crates source code and it looks good. However, I'm a bit worried about side-effects, if we ship it with Can you put it behind something like a "colors-on-windows" feature flag? Or do you have a better idea? Do you think a warning would suffice? I´m open to suggestions. :-) |
Btw, I decided that the next release |
It's true that at the end of the day, it's kind of a hack, but the alternative requires an extensive rewrite, and seeing as Microsoft will eventually enable VT100 emulation by default in CMD and Powershell, will require to revert back all the changes, while this could just sit behind a flag for Windows targets until Microsoft finalize their support for VT100, and could be then removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put a short note in the documentation about possible side-effects on windows - and make the dependencies platform-specific
NOTE: your changes compile with Rust 1.31, which is good enough for the next scheduled release.
thx :-)
@@ -18,3 +18,5 @@ travis-ci = { repository = "colin-kiegel/rust-pretty-assertions" } | |||
[dependencies] | |||
difference = "2.0.0" | |||
ansi_term = "0.11" | |||
output_vt100 = "0.1" | |||
ctor = "0.1.7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make this platform-specific dependencies
https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies
Thanks alot for ur contribution |
Would it be possible to implement? |
Hi there!
This is a fix for the issue #15. Turns out CMD and PowerShell both support ANSI colors, but it is disabled by default and it can be enabled with the correct system calls. And that’s basically what the crate output_vt100 does, which I’ve just released.
I also made the
output_vt100::init()
function (which activates the escaped characters for Windows) to be called at launch for any crate callingpretty_assertions
thanks to the crate ctor, but maybe it should be made optional? (since it apparently also fails the Rust 1.17 tests)