Skip to content

Commit 671d1b0

Browse files
authored
Merge pull request #12501 from DeterminateSystems/stop-progress-bar
Remove {start,stop}ProgressBar()
2 parents ff2798b + 9b57f9b commit 671d1b0

File tree

16 files changed

+16
-53
lines changed

16 files changed

+16
-53
lines changed

src/libmain/loggers.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ void setLogFormat(const std::string & logFormatStr)
5050
void setLogFormat(const LogFormat & logFormat)
5151
{
5252
defaultLogFormat = logFormat;
53-
createDefaultLogger();
54-
}
55-
56-
void createDefaultLogger()
57-
{
5853
logger = makeDefaultLogger();
5954
}
6055

src/libmain/loggers.hh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@ enum class LogFormat {
1616
void setLogFormat(const std::string & logFormatStr);
1717
void setLogFormat(const LogFormat & logFormat);
1818

19-
void createDefaultLogger();
20-
2119
}

src/libmain/progress-bar.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -560,15 +560,4 @@ std::unique_ptr<Logger> makeProgressBar()
560560
return std::make_unique<ProgressBar>(isTTY());
561561
}
562562

563-
void startProgressBar()
564-
{
565-
logger = makeProgressBar();
566-
}
567-
568-
void stopProgressBar()
569-
{
570-
if (auto progressBar = dynamic_cast<ProgressBar *>(logger.get()))
571-
progressBar->stop();
572-
}
573-
574563
}

src/libmain/progress-bar.hh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,4 @@ namespace nix {
77

88
std::unique_ptr<Logger> makeProgressBar();
99

10-
void startProgressBar();
11-
12-
void stopProgressBar();
13-
1410
}

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

0 commit comments

Comments
 (0)