aboutsummaryrefslogtreecommitdiff
path: root/src/nix/prefetch.cc
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-08-10 16:02:42 -0700
committerJade Lovelace <lix@jade.fyi>2024-08-10 16:07:21 -0700
commit292567e0b0a4681eb8ca803c26293d70857fe387 (patch)
tree9ab98e53bafb1b91bcf41fe3b335d2a2568fb3ca /src/nix/prefetch.cc
parent3775b6ac88720ab10237bab4817313c920daffcb (diff)
fix: check if it is a Real terminal, not just if it is a terminal
This will stop printing stuff to dumb terminals that they don't support. I've overall audited usage of isatty and replaced the ones with intent to mean "is a Real terminal" with checking for that. I've also caught a case of carelessly assuming "is a tty" means "should be colour" in nix-env. Change-Id: I6d83725d9a2d932ac94ff2294f92c0a1100d23c9
Diffstat (limited to 'src/nix/prefetch.cc')
-rw-r--r--src/nix/prefetch.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nix/prefetch.cc b/src/nix/prefetch.cc
index 0b04a04e6..b99cd5dd0 100644
--- a/src/nix/prefetch.cc
+++ b/src/nix/prefetch.cc
@@ -4,11 +4,11 @@
#include "shared.hh"
#include "store-api.hh"
#include "filetransfer.hh"
-#include "finally.hh"
#include "tarfile.hh"
#include "attr-path.hh"
-#include "eval-inline.hh"
+#include "eval-inline.hh" // IWYU pragma: keep
#include "legacy.hh"
+#include "terminal.hh"
#include <nlohmann/json.hpp>
@@ -180,7 +180,7 @@ static int main_nix_prefetch_url(int argc, char * * argv)
if (args.size() > 2)
throw UsageError("too many arguments");
- if (isatty(STDERR_FILENO))
+ if (isOutputARealTerminal(StandardOutputStream::Stderr))
setLogFormat(LogFormat::bar);
auto store = openStore();