aboutsummaryrefslogtreecommitdiff
path: root/src/nix/repl.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-08 18:20:39 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-11 13:32:16 +0000
commit678d1c2aa0f499466c723d3461277dc197515f57 (patch)
treed724d5782585463da2bd2f41f7e92588e5085754 /src/nix/repl.cc
parent89effe9d4abde2ea8970736f79e0a6a499777692 (diff)
Factor out a `LogStore` interface
Continue progress on #5729. Just as I hoped, this uncovered an issue: the daemon protocol is missing a way to query build logs. This doesn't effect `unix://`, but does effect `ssh://`. A FIXME is left for this, so we come back to it later.
Diffstat (limited to 'src/nix/repl.cc')
-rw-r--r--src/nix/repl.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index 3a51a13e6..916353d8c 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -25,6 +25,7 @@ extern "C" {
#include "eval-inline.hh"
#include "attr-path.hh"
#include "store-api.hh"
+#include "log-store.hh"
#include "common-eval-args.hh"
#include "get-drvs.hh"
#include "derivations.hh"
@@ -526,9 +527,16 @@ bool NixRepl::processLine(std::string line)
bool foundLog = false;
RunPager pager;
for (auto & sub : subs) {
- auto log = sub->getBuildLog(drvPath);
+ auto * logSubP = dynamic_cast<LogStore *>(&*sub);
+ if (!logSubP) {
+ printInfo("Skipped '%s' which does not support retrieving build logs", sub->getUri());
+ continue;
+ }
+ auto & logSub = *logSubP;
+
+ auto log = logSub.getBuildLog(drvPath);
if (log) {
- printInfo("got build log for '%s' from '%s'", drvPathRaw, sub->getUri());
+ printInfo("got build log for '%s' from '%s'", drvPathRaw, logSub.getUri());
logger->writeToStdout(*log);
foundLog = true;
break;