mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-19 17:46:46 +02:00
libutil/terminal: cache isTTY()
This commit is contained in:
parent
8c1eeb4681
commit
c6f0407103
1 changed files with 4 additions and 1 deletions
|
@ -9,9 +9,12 @@ namespace nix {
|
|||
|
||||
bool isTTY()
|
||||
{
|
||||
return isatty(STDERR_FILENO)
|
||||
static const bool tty =
|
||||
isatty(STDERR_FILENO)
|
||||
&& getEnv("TERM").value_or("dumb") != "dumb"
|
||||
&& !(getEnv("NO_COLOR").has_value() || getEnv("NOCOLOR").has_value());
|
||||
|
||||
return tty;
|
||||
}
|
||||
|
||||
std::string filterANSIEscapes(std::string_view s, bool filterAll, unsigned int width)
|
||||
|
|
Loading…
Reference in a new issue