about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index d1703f483a89..1f9e4fb1e6be 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1,3 +1,4 @@
+#include <iostream>
 #include "config.h"
 
 #include "references.hh"
@@ -2161,8 +2162,14 @@ void DerivationGoal::startBuilder()
         singleton<set<int> >(builderOut.readSide), true, true);
 
     /* Check if setting up the build environment failed. */
-    string msg = readLine(builderOut.readSide);
-    if (!msg.empty()) throw Error(msg);
+    while (true) {
+        string msg = readLine(builderOut.readSide);
+        if (string(msg, 0, 1) == "\1") {
+            if (msg.size() == 1) break;
+            throw Error(string(msg, 1));
+        }
+        printMsg(lvlDebug, msg);
+    }
 
     if (settings.printBuildTrace) {
         printMsg(lvlError, format("@ build-started %1% - %2% %3%")
@@ -2178,6 +2185,8 @@ void DerivationGoal::runChild()
 
     try { /* child */
 
+        logType = ltFlat;
+
         commonChildInit(builderOut);
 
 #if CHROOT_ENABLED
@@ -2502,6 +2511,9 @@ void DerivationGoal::runChild()
             }
             sandboxProfile += ")\n";
 
+            debug("Generated sandbox profile:");
+            debug(sandboxProfile);
+
             builder = "/usr/bin/sandbox-exec";
             args.push_back("sandbox-exec");
             args.push_back("-p");
@@ -2519,13 +2531,7 @@ void DerivationGoal::runChild()
         restoreSIGPIPE();
 
         /* Indicate that we managed to set up the build environment. */
-        writeFull(STDERR_FILENO, "\n");
-
-        /* This needs to be after that fateful '\n', and I didn't want to duplicate code */
-        if (useChroot && SANDBOX_ENABLED) {
-            printMsg(lvlDebug, "Generated sandbox profile:");
-            printMsg(lvlDebug, sandboxProfile);
-        }
+        writeFull(STDERR_FILENO, string("\1\n"));
 
         /* Execute the program.  This should not return. */
         if (isBuiltin(*drv)) {
@@ -2547,7 +2553,7 @@ void DerivationGoal::runChild()
         throw SysError(format("executing ‘%1%’") % drv->builder);
 
     } catch (std::exception & e) {
-        writeFull(STDERR_FILENO, "while setting up the build environment: " + string(e.what()) + "\n");
+        writeFull(STDERR_FILENO, "\1while setting up the build environment: " + string(e.what()) + "\n");
         _exit(1);
     }
 }