Skip to content

Commit 1aee6cf

Browse files
committed
stopProgressBar() -> logger->stop()
1 parent 258b5ef commit 1aee6cf

File tree

14 files changed

+16
-36
lines changed

14 files changed

+16
-36
lines changed

src/libmain/progress-bar.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,4 @@ void startProgressBar()
565565
logger = makeProgressBar();
566566
}
567567

568-
void stopProgressBar()
569-
{
570-
if (auto progressBar = dynamic_cast<ProgressBar *>(logger.get()))
571-
progressBar->stop();
572-
}
573-
574568
}

src/libmain/progress-bar.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ std::unique_ptr<Logger> makeProgressBar();
99

1010
void startProgressBar();
1111

12-
void stopProgressBar();
13-
1412
}

src/libmain/shared.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ RunPager::RunPager()
361361
if (!pager) pager = getenv("PAGER");
362362
if (pager && ((std::string) pager == "" || (std::string) pager == "cat")) return;
363363

364-
stopProgressBar();
364+
logger->stop();
365365

366366
Pipe toPager;
367367
toPager.create();

src/nix/build.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "shared.hh"
44
#include "store-api.hh"
55
#include "local-fs-store.hh"
6-
#include "progress-bar.hh"
76

87
#include <nlohmann/json.hpp>
98

@@ -120,7 +119,7 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
120119
createOutLinks(outLink, toBuiltPaths(buildables), *store2);
121120

122121
if (printOutputPaths) {
123-
stopProgressBar();
122+
logger->stop();
124123
for (auto & buildable : buildables) {
125124
std::visit(overloaded {
126125
[&](const BuiltPath::Opaque & bo) {

src/nix/cat.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "command.hh"
22
#include "store-api.hh"
33
#include "nar-accessor.hh"
4-
#include "progress-bar.hh"
54

65
using namespace nix;
76

@@ -14,7 +13,7 @@ struct MixCat : virtual Args
1413
auto st = accessor->lstat(CanonPath(path));
1514
if (st.type != SourceAccessor::Type::tRegular)
1615
throw Error("path '%1%' is not a regular file", path);
17-
stopProgressBar();
16+
logger->stop();
1817

1918
writeFull(getStandardOutput(), accessor->readFile(CanonPath(path)));
2019
}

src/nix/develop.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "store-api.hh"
88
#include "outputs-spec.hh"
99
#include "derivations.hh"
10-
#include "progress-bar.hh"
1110

1211
#ifndef _WIN32 // TODO re-enable on Windows
1312
# include "run.hh"
@@ -731,7 +730,7 @@ struct CmdPrintDevEnv : Common, MixJSON
731730
{
732731
auto buildEnvironment = getBuildEnvironment(store, installable).first;
733732

734-
stopProgressBar();
733+
logger->stop();
735734

736735
if (json) {
737736
logger->writeToStdout(buildEnvironment.toJSON());

src/nix/edit.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "shared.hh"
44
#include "eval.hh"
55
#include "attr-path.hh"
6-
#include "progress-bar.hh"
76
#include "editor-for.hh"
87

98
#include <unistd.h>
@@ -40,7 +39,7 @@ struct CmdEdit : InstallableValueCommand
4039
}
4140
}();
4241

43-
stopProgressBar();
42+
logger->stop();
4443

4544
auto args = editorFor(file, line);
4645

src/nix/eval.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "eval.hh"
66
#include "eval-inline.hh"
77
#include "value-to-json.hh"
8-
#include "progress-bar.hh"
98

109
#include <nlohmann/json.hpp>
1110

@@ -75,7 +74,7 @@ struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption
7574
}
7675

7776
if (writeTo) {
78-
stopProgressBar();
77+
logger->stop();
7978

8079
if (fs::symlink_exists(*writeTo))
8180
throw Error("path '%s' already exists", writeTo->string());
@@ -114,7 +113,7 @@ struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption
114113
}
115114

116115
else if (raw) {
117-
stopProgressBar();
116+
logger->stop();
118117
writeFull(getStandardOutput(), *state->coerceToString(noPos, *v, context, "while generating the eval command output"));
119118
}
120119

src/nix/log.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "shared.hh"
44
#include "store-api.hh"
55
#include "log-store.hh"
6-
#include "progress-bar.hh"
76

87
using namespace nix;
98

@@ -55,7 +54,7 @@ struct CmdLog : InstallableCommand
5554

5655
auto log = logSub.getBuildLog(path);
5756
if (!log) continue;
58-
stopProgressBar();
57+
logger->stop();
5958
printInfo("got build log for '%s' from '%s'", installable->what(), logSub.getUri());
6059
writeFull(getStandardOutput(), *log);
6160
return;

src/nix/prefetch.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ static int main_nix_prefetch_url(int argc, char * * argv)
190190
if (args.size() > 2)
191191
throw UsageError("too many arguments");
192192

193-
Finally f([]() { stopProgressBar(); });
193+
Finally f([]() { logger->stop(); });
194194

195195
if (isTTY())
196-
startProgressBar();
196+
startProgressBar();
197197

198198
auto store = openStore();
199199
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)
247247
auto [storePath, hash] = prefetchFile(
248248
store, resolveMirrorUrl(*state, url), name, ha, expectedHash, unpack, executable);
249249

250-
stopProgressBar();
250+
logger->stop();
251251

252252
if (!printPath)
253253
printInfo("path is '%s'", store->printStorePath(storePath));

0 commit comments

Comments
 (0)