-
-
Notifications
You must be signed in to change notification settings - Fork 75
Disable output colorization on terminals that don't support it #318
Conversation
The current version of the colored crate ignores the capabilities of the terminal (see colored-rs/colored#108), which makes the outupt of probe-run unparseable in e.g. emacs compilation mode. As a temporary workaround, this patch overrides colorization if probe-run is called from a terminal without color support.
180607d
to
a6baa05
Compare
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.
Hi @fhars, thank you for the patch. I tested it and it seems to work as expected. Can you please add the Cargo.lock
file as well?
I have two concerns regarding the added terminfo
dependency:
- The maintenance of it seems to be currently unclear. See Maintainance of this crate meh/rust-terminfo#20. There are a few people interested in taking over maintenance, but it seems the handover didn't happen yet.
- It adds outdated versions for a few dependencies, which some of them are already part of our dependency tree. This partially like a symptom of point 1.
I think it is reasonable to merge this PR anyways, but we should keep an eye on that and if it stays unmaintained eventually look for an alternative crate.
Does emacs' compilation mode present itself as a terminal (via |
From reading colored-rs/colored#108 I understood that it is setting |
@fhars Since it is a temporary fix until |
That would fix the immediate use case of running it in a emacs compilation buffer, but the terminfo database on my system knows about 1332 kinds of terminal that do not have color support. (Although most of these are probably collectors items by now, it's decades since I have seen an operational tek4013). And given that colored seems to be in deep hibernation for the last years, nothing may last as long as a stopgap measure. |
320: Disable terminal colorization if `TERM=dumb` is set r=jonas-schievink a=Urhengulas This PR fixes the problem `@fhars` described in #318: > The current version of the colored crate ignores the capabilities of the terminal (see colored-rs/colored#108), which makes the outupt of probe-run unparseable in e.g. emacs compilation mode. It also supersedes #318 as a fix to the problem. The reason for not going with #318 is that it adds the `terminfo` crate as a dependency which seems unmaintained and with many outdated dependencies. Co-authored-by: Urhengulas <johann.hemmann@code.berlin>
Superseded by #320 |
The current version of the colored crate ignores the capabilities of
the terminal (see colored-rs/colored#108),
which makes the outupt of probe-run unparseable in e.g. emacs
compilation mode. As a temporary workaround, this patch overrides
colorization if probe-run is called from a terminal without color
support.