about summary refs log tree commit diff
path: root/src/nix/log.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-06T14·03+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-06T14·03+0200
commitdf4342bc175a153986ebcf5bce2a758d5353adeb (patch)
treed491cac5bd1c4d45c689fd1a19c98958c32e9674 /src/nix/log.cc
parent1277aab219c83beae856024eea6e868677f7523b (diff)
nix build: Create result symlinks
Diffstat (limited to 'src/nix/log.cc')
-rw-r--r--src/nix/log.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/nix/log.cc b/src/nix/log.cc
index ba5e71c10a..15ae61d08c 100644
--- a/src/nix/log.cc
+++ b/src/nix/log.cc
@@ -24,23 +24,25 @@ struct CmdLog : InstallableCommand
 
     void run(ref<Store> store) override
     {
+        settings.readOnlyMode = true;
+
         auto subs = getDefaultSubstituters();
 
         subs.push_front(store);
 
-        for (auto & b : installable->toBuildable(true)) {
-
-            for (auto & sub : subs) {
-                auto log = b.second.drvPath != "" ? sub->getBuildLog(b.second.drvPath) : nullptr;
-                if (!log) {
-                    log = sub->getBuildLog(b.first);
-                    if (!log) continue;
-                }
-                stopProgressBar();
-                printInfo("got build log for '%s' from '%s'", b.first, sub->getUri());
-                std::cout << *log;
-                return;
+        auto b = installable->toBuildable();
+
+        for (auto & sub : subs) {
+            auto log = b.drvPath != "" ? sub->getBuildLog(b.drvPath) : nullptr;
+            for (auto & output : b.outputs) {
+                if (log) break;
+                log = sub->getBuildLog(output.second);
             }
+            if (!log) continue;
+            stopProgressBar();
+            printInfo("got build log for '%s' from '%s'", installable->what(), sub->getUri());
+            std::cout << *log;
+            return;
         }
 
         throw Error("build log of '%s' is not available", installable->what());