mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 09:36: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 "xml-writer.hh"
|
||||||
#include "legacy.hh"
|
#include "legacy.hh"
|
||||||
#include "eval-settings.hh" // for defexpr
|
#include "eval-settings.hh" // for defexpr
|
||||||
|
#include "terminal.hh"
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
@ -1089,7 +1090,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tty = isatty(STDOUT_FILENO);
|
bool tty = shouldANSI();
|
||||||
RunPager pager;
|
RunPager pager;
|
||||||
|
|
||||||
Table table;
|
Table table;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "loggers.hh"
|
#include "loggers.hh"
|
||||||
#include "markdown.hh"
|
#include "markdown.hh"
|
||||||
#include "memory-input-accessor.hh"
|
#include "memory-input-accessor.hh"
|
||||||
|
#include "terminal.hh"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
@ -375,7 +376,9 @@ void mainWrapped(int argc, char * * argv)
|
||||||
|
|
||||||
setLogFormat("bar");
|
setLogFormat("bar");
|
||||||
settings.verboseBuild = false;
|
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;
|
verbosity = lvlNotice;
|
||||||
} else {
|
} else {
|
||||||
verbosity = lvlInfo;
|
verbosity = lvlInfo;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "legacy.hh"
|
#include "legacy.hh"
|
||||||
#include "posix-source-accessor.hh"
|
#include "posix-source-accessor.hh"
|
||||||
#include "misc-store-flags.hh"
|
#include "misc-store-flags.hh"
|
||||||
|
#include "terminal.hh"
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
@ -188,7 +189,7 @@ static int main_nix_prefetch_url(int argc, char * * argv)
|
||||||
|
|
||||||
Finally f([]() { stopProgressBar(); });
|
Finally f([]() { stopProgressBar(); });
|
||||||
|
|
||||||
if (isatty(STDERR_FILENO))
|
if (shouldANSI())
|
||||||
startProgressBar();
|
startProgressBar();
|
||||||
|
|
||||||
auto store = openStore();
|
auto store = openStore();
|
||||||
|
|
Loading…
Reference in a new issue