From dac2045d0880e558ac9c72841d430d236398254e Mon Sep 17 00:00:00 2001 From: Qyriad Date: Tue, 18 Jun 2024 22:15:16 -0600 Subject: [PATCH] repl: respect --print-build-logs & fix memory leak 243c0f18d[1] allowed the logger's progress bar to display during repl builds, but startProgressBar() re-creates the entire logger from scratch, discarding the value of printBuildLogs (and leaking the previous logger). In this commit, we instead call logger->pause() and logger->resume(). [1]: 243c0f18dae2a08ea0e46f7ff33277c63f7506d7 Change-Id: Ie734d1f638d45759d232805d7e3c2005f7dea483 --- src/libcmd/repl.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 49865aa90..d87f61f39 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -268,7 +268,7 @@ ReplExitStatus NixRepl::mainLoop() /* Stop the progress bar because it interferes with the display of the repl. */ - stopProgressBar(); + logger->pause(); std::string input; @@ -622,9 +622,9 @@ ProcessLineResult NixRepl::processLine(std::string line) // TODO: this only shows a progress bar for explicitly initiated builds, // not eval-time fetching or builds performed for IFD. // But we can't just show it everywhere, since that would erase partial output from evaluation. - startProgressBar(); + logger->resume(); Finally stopLogger([&]() { - stopProgressBar(); + logger->pause(); }); state->store->buildPaths({