From 9d24b5d56e024b51240fe1010810f1c343de01ff Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sat, 20 Oct 2018 01:11:22 -0500 Subject: [PATCH] nix-prefetch-url: progressbar --- src/nix-prefetch-url/nix-prefetch-url.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/nix-prefetch-url/nix-prefetch-url.cc b/src/nix-prefetch-url/nix-prefetch-url.cc index ddb724913..54a402241 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 @@ -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(myArgs.searchPath, store);