about summary refs log tree commit diff
path: root/src/nix-prefetch-url
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-10-20T06·11-0500
committerWill Dietz <w@wdtz.org>2018-10-26T18·19-0500
commit9d24b5d56e024b51240fe1010810f1c343de01ff (patch)
treecdaf68a4ef7b524edf9cdb47e32e62bd0219e600 /src/nix-prefetch-url
parentf6a3dfe4e06980b2d060fd1a646cb5ca20f29779 (diff)
nix-prefetch-url: progressbar
Diffstat (limited to 'src/nix-prefetch-url')
-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);