about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-11-09T09·29+0100
committerEelco Dolstra <edolstra@gmail.com>2018-11-09T09·29+0100
commit220c79ec22ea71f89f3b2aeb84b77c022e89f5e5 (patch)
treee514605342db2690a0875347bfdd88c64a555f70
parent4ea4d0b1a39deb0f12a66e10e4809f2d0ddb324e (diff)
parent9d24b5d56e024b51240fe1010810f1c343de01ff (diff)
Merge branch 'feature/prefetch-progress' of https://github.com/dtzWill/nix
-rw-r--r--src/nix-prefetch-url/nix-prefetch-url.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nix-prefetch-url/nix-prefetch-url.cc b/src/nix-prefetch-url/nix-prefetch-url.cc
index ddb724913214..54a402241e3d 100644
--- a/src/nix-prefetch-url/nix-prefetch-url.cc
+++ b/src/nix-prefetch-url/nix-prefetch-url.cc
@@ -7,6 +7,8 @@
 #include "common-eval-args.hh"
 #include "attr-path.hh"
 #include "legacy.hh"
+#include "finally.hh"
+#include "progress-bar.hh"
 
 #include <iostream>
 
@@ -96,6 +98,11 @@ static int _main(int argc, char * * argv)
         if (args.size() > 2)
             throw UsageError("too many arguments");
 
+        Finally f([]() { stopProgressBar(); });
+
+        if (isatty(STDERR_FILENO))
+          startProgressBar();
+
         auto store = openStore();
         auto state = std::make_unique<EvalState>(myArgs.searchPath, store);