From de552c42cb304ff320bc042a37b2f46ecd20c63b Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Wed, 21 Aug 2024 17:28:42 +0200 Subject: [PATCH] Stop the logger in legacy commands again Commit 0dd1d8ca1cdccfc620644a7f690ed35bcd2d1e74 included an accidental revert of 1461e6cdda06f7f461114cce5b415f6d50381311 (actually slightly worse), leading to the progress bar not being stopped properly when a legacy command was invoked with `--log-format bar` (or similar options that show a progress bar). Move the progress bar stopping code to its proper place again to fix this regression. Change-Id: I676333da096d5990b717a387924bb988c9b73fab --- src/nix/main.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nix/main.cc b/src/nix/main.cc index e84e4f310..97f4b4a63 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -353,6 +353,9 @@ void mainWrapped(int argc, char * * argv) argv++; argc--; } + // Clean up the progress bar if shown using --log-format in a legacy command too. + // Otherwise, this is a harmless no-op. + Finally f([] { logger->pause(); }); { auto legacy = (*RegisterLegacyCommand::commands)[programName]; if (legacy) return legacy(argc, argv); @@ -361,7 +364,6 @@ void mainWrapped(int argc, char * * argv) evalSettings.pureEval = true; setLogFormat(LogFormat::bar); - Finally f([] { logger->pause(); }); settings.verboseBuild = false; // FIXME: stop messing about with log verbosity depending on if it is interactive use if (isatty(STDERR_FILENO)) {