aboutsummaryrefslogtreecommitdiff
path: root/src/nix/cat.cc
diff options
context:
space:
mode:
authorPuck Meerburg <puck@puckipedia.com>2024-05-17 20:01:50 +0000
committerPuck Meerburg <puck@puckipedia.com>2024-05-18 17:51:16 +0000
commit1fe58bd8a747f9c6d5b27c521fbf3d7b281e130d (patch)
tree8ca17c581b5f4d7d98bce7f652f6fc7c43dc15fc /src/nix/cat.cc
parentd1c8fd3b0981a53f122dc4b9e5cda705de3c1ac2 (diff)
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: https://git.lix.systems/lix-project/lix/issues/320 Change-Id: I5ac706d71d839b6dfa760b60a351414cd96297cf
Diffstat (limited to 'src/nix/cat.cc')
-rw-r--r--src/nix/cat.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nix/cat.cc b/src/nix/cat.cc
index 60aa66ce0..678edd9a1 100644
--- a/src/nix/cat.cc
+++ b/src/nix/cat.cc
@@ -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);
}
};