about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-06-29T09·41+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-06-29T09·41+0000
commitf5d5ffe536398fa1b0612a3613ed68734ebe8a60 (patch)
tree3063071463b63fd4c83815751cb061c9cda6c833 /src/libstore
parent00aadf478b61264247df3c0c6e43304d9fa0c053 (diff)
* Write build logs to disk again.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/normalise.cc30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc
index a6bac62bf3ef..682ea2a80e6a 100644
--- a/src/libstore/normalise.cc
+++ b/src/libstore/normalise.cc
@@ -87,6 +87,11 @@ public:
 
     virtual void waiteeDone(GoalPtr waitee, bool success);
 
+    virtual void writeLog(int fd, const unsigned char * buf, size_t count)
+    {
+        abort();
+    }
+
     void trace(const format & f);
     
 protected:
@@ -395,6 +400,9 @@ private:
     /* Delete the temporary directory, if we have one. */
     void deleteTmpDir(bool force);
 
+    /* Callback used by the worker to write to the log. */
+    void writeLog(int fd, const unsigned char * buf, size_t count);
+
     string name();
 };
 
@@ -1183,6 +1191,14 @@ void NormalisationGoal::deleteTmpDir(bool force)
 }
 
 
+void NormalisationGoal::writeLog(int fd,
+    const unsigned char * buf, size_t count)
+{
+    assert(fd == logPipe.readSide);
+    writeFull(fdLogFile, buf, count);
+}
+
+
 string NormalisationGoal::name()
 {
     return (format("normalisation of `%1%'") % nePath).str();
@@ -1407,6 +1423,9 @@ public:
     void tryToRun();
     void finished();
 
+    /* Callback used by the worker to write to the log. */
+    void writeLog(int fd, const unsigned char * buf, size_t count);
+
     string name();
 };
 
@@ -1645,6 +1664,15 @@ void SubstitutionGoal::finished()
 }
 
 
+void SubstitutionGoal::writeLog(int fd,
+    const unsigned char * buf, size_t count)
+{
+    assert(fd == logPipe.readSide);
+    /* Don't write substitution output to a log file for now.  We
+       probably should, though. */
+}
+
+
 string SubstitutionGoal::name()
 {
     return (format("substitution of `%1%'") % storePath).str();
@@ -1922,7 +1950,7 @@ void Worker::waitForInput()
             } else {
                 printMsg(lvlVomit, format("%1%: read %2% bytes")
                     % goal->name() % rd);
-//                 writeFull(goal.fdLogFile, buffer, rd); !!!
+                goal->writeLog(fd, buffer, (size_t) rd);
                 if (verbosity >= buildVerbosity)
                     writeFull(STDERR_FILENO, buffer, rd);
             }