Skip to content

Commit

Permalink
libstore/build: add a few explanatory comments; simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma27 committed Feb 27, 2022
1 parent 300590d commit 9fcd332
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/libstore/build/derivation-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,7 @@ bool DerivationGoal::isReadDesc(int fd)

void DerivationGoal::handleChildOutput(int fd, std::string_view data)
{
// local & `ssh://`-builds are dealt with here.
auto isWrittenToLog = isReadDesc(fd);
if (isWrittenToLog)
{
Expand Down Expand Up @@ -1210,11 +1211,11 @@ void DerivationGoal::handleChildOutput(int fd, std::string_view data)
auto json = parseJSONMessage(currentHookLine);
if (json) {
auto s = handleJSONLogMessage(*json, worker.act, hook->activities, true);
if (s && !isWrittenToLog && logSink) {
if ((*json)["type"] == resBuildLogLine) {
auto f = (*json)["fields"];
(*logSink)((f.size() > 0 ? f.at(0).get<std::string>() : "") + "\n");
}
// ensure that logs from a builder using `ssh-ng://` as protocol
// are also available to `nix log`.
if (s && !isWrittenToLog && logSink && (*json)["type"] == resBuildLogLine) {
auto f = (*json)["fields"];
(*logSink)((f.size() > 0 ? f.at(0).get<std::string>() : "") + "\n");
}
}
currentHookLine.clear();
Expand Down

0 comments on commit 9fcd332

Please sign in to comment.