Skip to content

--color=always still checks for a terminal before printing colors #31546

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
durka opened this issue Feb 10, 2016 · 4 comments
Closed

--color=always still checks for a terminal before printing colors #31546

durka opened this issue Feb 10, 2016 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@durka
Copy link
Contributor

durka commented Feb 10, 2016

rustc --color=always foo.rs 2>&1 | cat

This produces colored output on 1.6.0, but not 1.7.0 or 1.8.0. Related to rust-lang/rust-playpen#174, cc @nrc.

@durka
Copy link
Contributor Author

durka commented Feb 10, 2016

Also related to #29999, @Stebalien do you have any thoughts?

@TimNN
Copy link
Contributor

TimNN commented Feb 10, 2016

I also commented on the playpen issue and think that some change (maybe #29999) changed term::stderr() so that it no longer returns Some(_) if stderr is not a tty or something like that.

@nrc nrc added the A-diagnostics Area: Messages for errors, warnings, and lints label Feb 10, 2016
@nrc
Copy link
Member

nrc commented Feb 10, 2016

A fix for this should get uplifted to Beta (not sure how to signal that with the available labels).

@Stebalien
Copy link
Contributor

Ignoring windows...

The term library doesn't care if it's writing to a TTY, only if (1) the TERM environment variable is set and (2) it can find/parse the terminfo database.

This appears to have been introduced in #30711. Adding -Z unstable-options --error-format=human brings the color back. I've submitted a pull-request.

Stebalien added a commit to Stebalien/rust that referenced this issue Feb 11, 2016
bors added a commit that referenced this issue Feb 12, 2016
brson pushed a commit to brson/rust that referenced this issue Feb 26, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

4 participants