Merge "nix cat/dump-path/key: stop progress bar before writeFull" into main

This commit is contained in:
Puck Meerburg 2024-05-18 20:13:48 +00:00 committed by Gerrit Code Review
commit 62b1adf8c1
3 changed files with 11 additions and 1 deletions

View file

@ -2,6 +2,7 @@
#include "store-api.hh" #include "store-api.hh"
#include "fs-accessor.hh" #include "fs-accessor.hh"
#include "nar-accessor.hh" #include "nar-accessor.hh"
#include "progress-bar.hh"
using namespace nix; using namespace nix;
@ -17,7 +18,10 @@ struct MixCat : virtual Args
if (st.type != FSAccessor::Type::tRegular) if (st.type != FSAccessor::Type::tRegular)
throw Error("path '%1%' is not a regular file", path); throw Error("path '%1%' is not a regular file", path);
writeFull(STDOUT_FILENO, accessor->readFile(path)); auto file = accessor->readFile(path);
stopProgressBar();
writeFull(STDOUT_FILENO, file);
} }
}; };

View file

@ -1,6 +1,7 @@
#include "command.hh" #include "command.hh"
#include "store-api.hh" #include "store-api.hh"
#include "archive.hh" #include "archive.hh"
#include "progress-bar.hh"
using namespace nix; using namespace nix;
@ -20,6 +21,7 @@ struct CmdDumpPath : StorePathCommand
void run(ref<Store> store, const StorePath & storePath) override void run(ref<Store> store, const StorePath & storePath) override
{ {
stopProgressBar();
FdSink sink(STDOUT_FILENO); FdSink sink(STDOUT_FILENO);
store->narFromPath(storePath, sink); store->narFromPath(storePath, sink);
sink.flush(); sink.flush();
@ -55,6 +57,7 @@ struct CmdDumpPath2 : Command
void run() override void run() override
{ {
stopProgressBar();
FdSink sink(STDOUT_FILENO); FdSink sink(STDOUT_FILENO);
dumpPath(path, sink); dumpPath(path, sink);
sink.flush(); sink.flush();

View file

@ -3,6 +3,7 @@
#include "store-api.hh" #include "store-api.hh"
#include "thread-pool.hh" #include "thread-pool.hh"
#include "signals.hh" #include "signals.hh"
#include "progress-bar.hh"
#include <atomic> #include <atomic>
@ -220,6 +221,8 @@ struct CmdKey : NixMultiCommand
{ {
if (!command) if (!command)
throw UsageError("'nix key' requires a sub-command."); throw UsageError("'nix key' requires a sub-command.");
stopProgressBar();
command->second->run(); command->second->run();
} }
}; };