Skip to content

cargo report future-incompatibilities doesn't check for color support correctly #9960

@ehuss

Description

@ehuss

Problem
cargo report future-incompatibilities does not check for color support correctly. If you pipe the output to a file or something like less, it is not stripping the colors. This wasn't quite the intended behavior in #9606. The issue is here where it only checks if stderr supports color.

Steps

  1. cargo report future-incompatibilities > some_file

Notice that some_file contains lots of escape characters

Possible Solution(s)

I'm not entirely sure of the best approach to fix this. Perhaps just check if both stdout and stderr support color at the line noted above? I can't imagine a scenario where that would matter. I'd be reluctant to make this too fussy or complicated, though worst case the check to call strip_ansi_escapes::strip could be moved to the callers, but I think I'd rather avoid that.

Notes

Output of cargo version:

cargo 1.57.0-nightly (d56b42c 2021-09-27)

Metadata

Metadata

Assignees

Labels

A-console-outputArea: Terminal output, colors, progress bar, etc.A-future-incompatArea: future incompatible reportingC-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions