mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 06:26:15 +02:00
treewide: replace usages of isatty(STDERR_FILENO) with shouldANSI()
This commit is contained in:
parent
950b6401f9
commit
d9fc4bf5c5
3 changed files with 8 additions and 3 deletions
|
@ -16,6 +16,7 @@
|
|||
#include "xml-writer.hh"
|
||||
#include "legacy.hh"
|
||||
#include "eval-settings.hh" // for defexpr
|
||||
#include "terminal.hh"
|
||||
|
||||
#include <cerrno>
|
||||
#include <ctime>
|
||||
|
@ -1089,7 +1090,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
|
|||
return;
|
||||
}
|
||||
|
||||
bool tty = isatty(STDOUT_FILENO);
|
||||
bool tty = shouldANSI();
|
||||
RunPager pager;
|
||||
|
||||
Table table;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "loggers.hh"
|
||||
#include "markdown.hh"
|
||||
#include "memory-input-accessor.hh"
|
||||
#include "terminal.hh"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -375,7 +376,9 @@ void mainWrapped(int argc, char * * argv)
|
|||
|
||||
setLogFormat("bar");
|
||||
settings.verboseBuild = false;
|
||||
if (isatty(STDERR_FILENO)) {
|
||||
|
||||
// If on a terminal, progress will be displayed via progress bars etc. (thus verbosity=notice)
|
||||
if (nix::shouldANSI()) {
|
||||
verbosity = lvlNotice;
|
||||
} else {
|
||||
verbosity = lvlInfo;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "legacy.hh"
|
||||
#include "posix-source-accessor.hh"
|
||||
#include "misc-store-flags.hh"
|
||||
#include "terminal.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
@ -188,7 +189,7 @@ static int main_nix_prefetch_url(int argc, char * * argv)
|
|||
|
||||
Finally f([]() { stopProgressBar(); });
|
||||
|
||||
if (isatty(STDERR_FILENO))
|
||||
if (shouldANSI())
|
||||
startProgressBar();
|
||||
|
||||
auto store = openStore();
|
||||
|
|
Loading…
Reference in a new issue