mirror of
https://github.com/NixOS/nix
synced 2025-07-06 05:01:48 +02:00
commit
90f5189451
8 changed files with 28 additions and 18 deletions
|
@ -52,7 +52,7 @@ public:
|
|||
: printBuildLogs(printBuildLogs)
|
||||
{
|
||||
systemd = getEnv("IN_SYSTEMD") == "1";
|
||||
tty = shouldANSI();
|
||||
tty = isTTY();
|
||||
}
|
||||
|
||||
bool isVerbose() override {
|
||||
|
|
|
@ -7,11 +7,14 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
bool shouldANSI()
|
||||
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)
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace nix {
|
|||
* Determine whether ANSI escape sequences are appropriate for the
|
||||
* present output.
|
||||
*/
|
||||
bool shouldANSI();
|
||||
bool isTTY();
|
||||
|
||||
/**
|
||||
* Truncate a string to 'width' printable characters. If 'filterAll'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue