about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-08-31T12·36+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-08-31T12·36+0000
commitbf0dde959771661c6893001a7e0779b65d7be490 (patch)
treeeb147ea35d8fd77543332a95ff77e2fc32511945 /src/libstore/build.cc
parente2e168f7c27f5239badf6e8705264bd907d6b82c (diff)
* Always print hook output on stderr, even if --no-build-output is
  set.
* In the build hook, print a trace message to allow Hydra to pick up
  the name of the remote machine used for the build.

Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 30e37e4e9e..210486fbc2 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -678,7 +678,9 @@ HookInstance::HookInstance()
                 throw SysError("dupping builder's stdout/stderr");
             
             execl(buildHook.c_str(), buildHook.c_str(), thisSystem.c_str(),
-                (format("%1%") % maxSilentTime).str().c_str(), NULL);
+                (format("%1%") % maxSilentTime).str().c_str(),
+                (format("%1%") % printBuildTrace).str().c_str(),
+                NULL);
             
             throw SysError(format("executing `%1%'") % buildHook);
             
@@ -1362,7 +1364,8 @@ HookReply DerivationGoal::tryBuildHook()
             reply = string(s, 2);
             break;
         }
-        handleChildOutput(worker.hook->fromHook.readSide, s + "\n");
+        s += "\n";
+        writeToStderr((unsigned char *) s.c_str(), s.size());
     }
 
     debug(format("hook reply is `%1%'") % reply);
@@ -2023,11 +2026,16 @@ void DerivationGoal::deleteTmpDir(bool force)
 
 void DerivationGoal::handleChildOutput(int fd, const string & data)
 {
-    if (verbosity >= buildVerbosity)
-        writeToStderr((unsigned char *) data.c_str(), data.size());
     if ((hook && fd == hook->builderOut.readSide) ||
         (!hook && fd == builderOut.readSide))
+    {
+        if (verbosity >= buildVerbosity)
+            writeToStderr((unsigned char *) data.c_str(), data.size());
         writeFull(fdLogFile, (unsigned char *) data.c_str(), data.size());
+    }
+
+    if (hook && fd == hook->fromHook.readSide)
+        writeToStderr((unsigned char *) data.c_str(), data.size());
 }