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

Propagate --color option to rustc #2779

Merged
merged 1 commit into from
Jun 10, 2016

Conversation

matklad
Copy link
Member

@matklad matklad commented Jun 9, 2016

closes #2740

Will try to add a test for this soon (and fix failing tests if any, compiling/running tests locally is slow :( ).

I am not sure what is the right place to add --color option to the command line. I use build_base_args. process also looks like a good candidate, because it is more general, but if we look at the CommandType we see that only rustc command supports --color.

@rust-highfive
Copy link

r? @wycats

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

Ah yeah I think this location is fine, other places aren't necessarily invoking the compiler so it probably wants to avoid those directly. Thanks!

With a test r=me

@matklad
Copy link
Member Author

matklad commented Jun 10, 2016

Added the test.

And, OMG, someone has removed the test! macro, and I've just added support for context aware run configurations to IntelliJ Rust, so now I can run a single cargo test under cursor with just one shortcut!

@matklad
Copy link
Member Author

matklad commented Jun 10, 2016

Hm, ironically the tests pass in the IDE and not on the CI, because

        // Use `TermInfo::from_env()` and `TerminfoTerminal::supports_color()`
        // to determine if creation of a TerminfoTerminal is possible regardless
        // of the tty status. --color options are parsed after Shell creation so
        // always try to create a terminal that supports color output. Fall back
        // to a no-color terminal regardless of whether or not a tty is present
        // and if color output is not possible.

so no colors in the IDE with --color always without manually setting up the TERM env variable.

@matklad matklad changed the title [WIP] Propagate --color option to rustc Propagate --color option to rustc Jun 10, 2016
ColorConfig::Never => "never",
}.to_string()
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh actually, this should implement fmt::Display conventionally instead of ToString directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know, thanks!

@alexcrichton
Copy link
Member

@bors: r+ 76a48a9

Thanks!

@bors
Copy link
Collaborator

bors commented Jun 10, 2016

⌛ Testing commit 76a48a9 with merge 13861b7...

bors added a commit that referenced this pull request Jun 10, 2016
Propagate --color option to rustc

closes #2740

Will try to add a test for this soon (and fix failing tests if any, compiling/running tests locally is slow :( ).

I am not sure what is the right place to add `--color` option to the command line. I use [`build_base_args`]. [`process`] also looks like a good candidate, because it is more general, but if we look at the [`CommandType`] we see that only `rustc` command supports `--color`.

[`build_base_args`]: https://github.com/matklad/cargo/blob/1f7504397ce7c40ff708e2d31da164822e88ed37/src/cargo/ops/cargo_rustc/mod.rs#L449
[`process`]: https://github.com/matklad/cargo/blob/1f7504397ce7c40ff708e2d31da164822e88ed37/src/cargo/ops/cargo_rustc/mod.rs#L608
[`CommandType`]: https://github.com/matklad/cargo/blob/1f7504397ce7c40ff708e2d31da164822e88ed37/src/cargo/ops/cargo_rustc/engine.rs#L102
@bors
Copy link
Collaborator

bors commented Jun 10, 2016

@bors bors merged commit 76a48a9 into rust-lang:master Jun 10, 2016
@matklad matklad deleted the propagete-color-config branch August 19, 2016 22:45
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 this pull request may close these issues.

Pass --color option down to rustc
5 participants