forked from lix-project/lix
nix cat/dump-path/key: stop progress bar before writeFull
These commands outputs data that may not end with a newline. This
causes problems when the progress bar redraws, as that completely
wipes the last line of output. As nix key generate-secret outputs
a single line of text with no output, it shows up entirely blank,
making it look like nothing happened.
Fixes: lix-project/lix#320
Change-Id: I5ac706d71d839b6dfa760b60a351414cd96297cf
This commit is contained in:
parent
d1c8fd3b09
commit
1fe58bd8a7
|
@ -2,6 +2,7 @@
|
|||
#include "store-api.hh"
|
||||
#include "fs-accessor.hh"
|
||||
#include "nar-accessor.hh"
|
||||
#include "progress-bar.hh"
|
||||
|
||||
using namespace nix;
|
||||
|
||||
|
@ -17,7 +18,10 @@ struct MixCat : virtual Args
|
|||
if (st.type != FSAccessor::Type::tRegular)
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "command.hh"
|
||||
#include "store-api.hh"
|
||||
#include "archive.hh"
|
||||
#include "progress-bar.hh"
|
||||
|
||||
using namespace nix;
|
||||
|
||||
|
@ -20,6 +21,7 @@ struct CmdDumpPath : StorePathCommand
|
|||
|
||||
void run(ref<Store> store, const StorePath & storePath) override
|
||||
{
|
||||
stopProgressBar();
|
||||
FdSink sink(STDOUT_FILENO);
|
||||
store->narFromPath(storePath, sink);
|
||||
sink.flush();
|
||||
|
@ -55,6 +57,7 @@ struct CmdDumpPath2 : Command
|
|||
|
||||
void run() override
|
||||
{
|
||||
stopProgressBar();
|
||||
FdSink sink(STDOUT_FILENO);
|
||||
dumpPath(path, sink);
|
||||
sink.flush();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "store-api.hh"
|
||||
#include "thread-pool.hh"
|
||||
#include "signals.hh"
|
||||
#include "progress-bar.hh"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
|
@ -220,6 +221,8 @@ struct CmdKey : NixMultiCommand
|
|||
{
|
||||
if (!command)
|
||||
throw UsageError("'nix key' requires a sub-command.");
|
||||
|
||||
stopProgressBar();
|
||||
command->second->run();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue