This is an archive of the discontinued LLVM Phabricator instance.

[llvm/Support] Fallback to $TERM if terminfo has no "colors" capability
ClosedPublic

Authored by mib on May 18 2022, 11:33 AM.

Details

Summary

It can happen on macOS that the terminal doesn't report the "colors"
capability in the terminfo database, in which case tigetnum returns -1.

This doesn't mean however that the terminal doesn't supports color, it
just means that the capability is absent from the terminal description.

In that case, we should still fallback to the checking the $TERM
environment variable to see if it supports ANSI escapes codes.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.May 18 2022, 11:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 11:33 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
mib requested review of this revision.May 18 2022, 11:33 AM
This revision is now accepted and ready to land.May 18 2022, 11:53 AM
This revision was landed with ongoing or failed builds.May 18 2022, 6:23 PM
This revision was automatically updated to reflect the committed changes.