mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
stopProgressBar() -> logger->stop()
This commit is contained in:
parent
258b5ef80b
commit
1aee6cf974
14 changed files with 16 additions and 36 deletions
|
@ -565,10 +565,4 @@ void startProgressBar()
|
|||
logger = makeProgressBar();
|
||||
}
|
||||
|
||||
void stopProgressBar()
|
||||
{
|
||||
if (auto progressBar = dynamic_cast<ProgressBar *>(logger.get()))
|
||||
progressBar->stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,4 @@ std::unique_ptr<Logger> makeProgressBar();
|
|||
|
||||
void startProgressBar();
|
||||
|
||||
void stopProgressBar();
|
||||
|
||||
}
|
||||
|
|
|
@ -361,7 +361,7 @@ RunPager::RunPager()
|
|||
if (!pager) pager = getenv("PAGER");
|
||||
if (pager && ((std::string) pager == "" || (std::string) pager == "cat")) return;
|
||||
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
|
||||
Pipe toPager;
|
||||
toPager.create();
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "shared.hh"
|
||||
#include "store-api.hh"
|
||||
#include "local-fs-store.hh"
|
||||
#include "progress-bar.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
@ -120,7 +119,7 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
|
|||
createOutLinks(outLink, toBuiltPaths(buildables), *store2);
|
||||
|
||||
if (printOutputPaths) {
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
for (auto & buildable : buildables) {
|
||||
std::visit(overloaded {
|
||||
[&](const BuiltPath::Opaque & bo) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "command.hh"
|
||||
#include "store-api.hh"
|
||||
#include "nar-accessor.hh"
|
||||
#include "progress-bar.hh"
|
||||
|
||||
using namespace nix;
|
||||
|
||||
|
@ -14,7 +13,7 @@ struct MixCat : virtual Args
|
|||
auto st = accessor->lstat(CanonPath(path));
|
||||
if (st.type != SourceAccessor::Type::tRegular)
|
||||
throw Error("path '%1%' is not a regular file", path);
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
|
||||
writeFull(getStandardOutput(), accessor->readFile(CanonPath(path)));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "store-api.hh"
|
||||
#include "outputs-spec.hh"
|
||||
#include "derivations.hh"
|
||||
#include "progress-bar.hh"
|
||||
|
||||
#ifndef _WIN32 // TODO re-enable on Windows
|
||||
# include "run.hh"
|
||||
|
@ -731,7 +730,7 @@ struct CmdPrintDevEnv : Common, MixJSON
|
|||
{
|
||||
auto buildEnvironment = getBuildEnvironment(store, installable).first;
|
||||
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
|
||||
if (json) {
|
||||
logger->writeToStdout(buildEnvironment.toJSON());
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "shared.hh"
|
||||
#include "eval.hh"
|
||||
#include "attr-path.hh"
|
||||
#include "progress-bar.hh"
|
||||
#include "editor-for.hh"
|
||||
|
||||
#include <unistd.h>
|
||||
|
@ -40,7 +39,7 @@ struct CmdEdit : InstallableValueCommand
|
|||
}
|
||||
}();
|
||||
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
|
||||
auto args = editorFor(file, line);
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "eval.hh"
|
||||
#include "eval-inline.hh"
|
||||
#include "value-to-json.hh"
|
||||
#include "progress-bar.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
@ -75,7 +74,7 @@ struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption
|
|||
}
|
||||
|
||||
if (writeTo) {
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
|
||||
if (fs::symlink_exists(*writeTo))
|
||||
throw Error("path '%s' already exists", writeTo->string());
|
||||
|
@ -114,7 +113,7 @@ struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption
|
|||
}
|
||||
|
||||
else if (raw) {
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
writeFull(getStandardOutput(), *state->coerceToString(noPos, *v, context, "while generating the eval command output"));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "shared.hh"
|
||||
#include "store-api.hh"
|
||||
#include "log-store.hh"
|
||||
#include "progress-bar.hh"
|
||||
|
||||
using namespace nix;
|
||||
|
||||
|
@ -55,7 +54,7 @@ struct CmdLog : InstallableCommand
|
|||
|
||||
auto log = logSub.getBuildLog(path);
|
||||
if (!log) continue;
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
printInfo("got build log for '%s' from '%s'", installable->what(), logSub.getUri());
|
||||
writeFull(getStandardOutput(), *log);
|
||||
return;
|
||||
|
|
|
@ -190,10 +190,10 @@ static int main_nix_prefetch_url(int argc, char * * argv)
|
|||
if (args.size() > 2)
|
||||
throw UsageError("too many arguments");
|
||||
|
||||
Finally f([]() { stopProgressBar(); });
|
||||
Finally f([]() { logger->stop(); });
|
||||
|
||||
if (isTTY())
|
||||
startProgressBar();
|
||||
startProgressBar();
|
||||
|
||||
auto store = openStore();
|
||||
auto state = std::make_unique<EvalState>(myArgs.lookupPath, store, fetchSettings, evalSettings);
|
||||
|
@ -247,7 +247,7 @@ static int main_nix_prefetch_url(int argc, char * * argv)
|
|||
auto [storePath, hash] = prefetchFile(
|
||||
store, resolveMirrorUrl(*state, url), name, ha, expectedHash, unpack, executable);
|
||||
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
|
||||
if (!printPath)
|
||||
printInfo("path is '%s'", store->printStorePath(storePath));
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "local-fs-store.hh"
|
||||
#include "finally.hh"
|
||||
#include "source-accessor.hh"
|
||||
#include "progress-bar.hh"
|
||||
#include "eval.hh"
|
||||
#include <filesystem>
|
||||
|
||||
|
@ -34,7 +33,7 @@ void execProgramInStore(ref<Store> store,
|
|||
const Strings & args,
|
||||
std::optional<std::string_view> system)
|
||||
{
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
|
||||
restoreProcessContext();
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "shared.hh"
|
||||
#include "store-api.hh"
|
||||
#include "thread-pool.hh"
|
||||
#include "progress-bar.hh"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
|
@ -175,7 +174,7 @@ struct CmdKeyGenerateSecret : Command
|
|||
if (!keyName)
|
||||
throw UsageError("required argument '--key-name' is missing");
|
||||
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
writeFull(getStandardOutput(), SecretKey::generate(*keyName).to_string());
|
||||
}
|
||||
};
|
||||
|
@ -197,7 +196,7 @@ struct CmdKeyConvertSecretToPublic : Command
|
|||
void run() override
|
||||
{
|
||||
SecretKey secretKey(drainFD(STDIN_FILENO));
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
writeFull(getStandardOutput(), secretKey.toPublicKey().to_string());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "eval-settings.hh"
|
||||
#include "attr-path.hh"
|
||||
#include "names.hh"
|
||||
#include "progress-bar.hh"
|
||||
#include "executable-path.hh"
|
||||
#include "self-exe.hh"
|
||||
|
||||
|
@ -71,7 +70,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
|
|||
auto version = DrvName(storePath.name()).version;
|
||||
|
||||
if (dryRun) {
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
warn("would upgrade to version %s", version);
|
||||
return;
|
||||
}
|
||||
|
@ -89,7 +88,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
|
|||
throw Error("could not verify that '%s' works", program);
|
||||
}
|
||||
|
||||
stopProgressBar();
|
||||
logger->stop();
|
||||
|
||||
{
|
||||
Activity act(*logger, lvlInfo, actUnknown,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "command.hh"
|
||||
#include "store-api.hh"
|
||||
#include "progress-bar.hh"
|
||||
#include "source-accessor.hh"
|
||||
#include "shared.hh"
|
||||
|
||||
|
@ -110,8 +109,6 @@ struct CmdWhyDepends : SourceExprCommand, MixOperateOnOptions
|
|||
auto dependencyPath = *optDependencyPath;
|
||||
auto dependencyPathHash = dependencyPath.hashPart();
|
||||
|
||||
stopProgressBar(); // FIXME
|
||||
|
||||
auto accessor = store->getFSAccessor();
|
||||
|
||||
auto const inf = std::numeric_limits<size_t>::max();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue