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