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

No colors from rustc/cargo #646

Closed
9ary opened this issue Sep 1, 2016 · 7 comments
Closed

No colors from rustc/cargo #646

9ary opened this issue Sep 1, 2016 · 7 comments

Comments

@9ary
Copy link

9ary commented Sep 1, 2016

The run window doesn't show colored compiler output, even with --color always.

I've changed the stderr color, tried disabling it as well.
I'm running 0.0.1.955 in PyCharm Community 2016.2.2, rustc 1.11.0 and cargo 0.12.0.

My program is outputting colored text to stdout which works fine, if I output to stderr, it doesn't though.

@matklad
Copy link
Member

matklad commented Sep 6, 2016

Note to self:

On linux, add .withRedirectErrorStream(true) to CargoRunState and set TERM=linux. Not sure what should be done for windows though.

@alygin
Copy link
Member

alygin commented Sep 20, 2016

On Windows, rustc uses the Win console API to produce color output. The only exception is the msys terminal for which it emits ANSI escape codes, but unfortunately, it does it incorrectly.

@alygin
Copy link
Member

alygin commented Oct 7, 2016

Works fine on mac with the following settings in the Cargo class:

.withEnvironment("TERM", "linux")
.withEnvironment("RUSTFLAGS", "--color=always")
.withRedirectErrorStream(true)

image

On Windows, it should be .withEnvironment("TERM", "msys"), but it was broken last time I tried to use it.

@alygin
Copy link
Member

alygin commented Nov 29, 2016

@matklad, what do you think, should we use the colorful output only on linux and mac? Are there other platform-dependent features in the plugin?

@matklad
Copy link
Member

matklad commented Nov 29, 2016

Yep, I guess it is fine to set TERM on linux and to add --color always to the Cargo flags on linux. It'd be great to figure out how to do this on windows as well.

However, we really should not use RUSTFLAGS, because they go into Cargo's fingerprints, and you might get some spurious recompilation. I remember an issue that Cargo should pass --color through to the compiler (Ah, I fixed it actually: rust-lang/cargo#2779 :) )

The issues about windows: rust-lang/cargo#3077, Stebalien/term#58.

@sanmai-NL
Copy link

sanmai-NL commented Dec 11, 2016

@matklad: 0.1.0.1259-nightly now fails on my IntelliJ Run command since it appends --color always to the complete command line instead of to the cargo command parameters.

cargo run --bin program -- --my-arg test --color=always
error: Found argument '--color' which wasn't expected, or isn't valid in this context

@alygin
Copy link
Member

alygin commented Dec 11, 2016

@sanmai-NL, please, have a look at a possible workaround.

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

No branches or pull requests

4 participants