Stop the logger in legacy commands again

Commit 0dd1d8ca1c included an accidental revert
of 1461e6cdda (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
This commit is contained in:
Alois Wohlschlager 2024-08-21 17:28:42 +02:00
parent e38410799b
commit de552c42cb
No known key found for this signature in database
GPG key ID: E0F59EA5E5216914

View file

@ -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)) {