diff --git a/lix/libstore/build/derivation-goal.cc b/lix/libstore/build/derivation-goal.cc index ca024c960..27bfef0d1 100644 --- a/lix/libstore/build/derivation-goal.cc +++ b/lix/libstore/build/derivation-goal.cc @@ -1229,6 +1229,30 @@ Goal::WorkResult DerivationGoal::tooMuchLogs() kj::Promise>> DerivationGoal::handleBuilderOutput(AsyncInputStream & in) noexcept try { + std::string currentLogLine; + size_t currentLogLinePos = 0; // to handle carriage return + + auto flushLine = [&] { + KJ_DEFER({ + currentLogLine = ""; + currentLogLinePos = 0; + }); + + if (const auto state = handleJSONLogMessage( + currentLogLine, *act, builderActivities, "the derivation builder", false + )) + { + return *state; + } else { + logTail.push_back(currentLogLine); + if (logTail.size() > settings.logLines) { + logTail.pop_front(); + } + + return act->result(resBuildLogLine, currentLogLine); + } + }; + auto buf = kj::heapArray(4096); while (true) { std::string_view data; @@ -1417,27 +1441,6 @@ DerivationGoal::handleChildStreams(AsyncInputStream * builderIn, AsyncInputStrea co_return std::nullopt; } -Logger::BufferState DerivationGoal::flushLine() -{ - KJ_DEFER({ - currentLogLine = ""; - currentLogLinePos = 0; - }); - - if (const auto state = handleJSONLogMessage( - currentLogLine, *act, builderActivities, "the derivation builder", false - )) - { - return *state; - } else { - logTail.push_back(currentLogLine); - if (logTail.size() > settings.logLines) logTail.pop_front(); - - return act->result(resBuildLogLine, currentLogLine); - } -} - - kj::Promise> DerivationGoal::queryDerivationOutputMap() try { OutputPathMap res; diff --git a/lix/libstore/build/derivation-goal.hh b/lix/libstore/build/derivation-goal.hh index 2df3adf42..8bd7b2975 100644 --- a/lix/libstore/build/derivation-goal.hh +++ b/lix/libstore/build/derivation-goal.hh @@ -201,9 +201,6 @@ struct DerivationGoal : public Goal */ std::list logTail; - std::string currentLogLine; - size_t currentLogLinePos = 0; // to handle carriage return - std::string currentHookLine; /** @@ -325,7 +322,6 @@ protected: kj::Promise>> handleHookOutput(AsyncInputStream & in) noexcept; kj::Promise>> monitorForSilence() noexcept; WorkResult tooMuchLogs(); - Logger::BufferState flushLine(); virtual std::string buildErrorContents(const std::string & exitMsg, bool diskFull);