diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc index a6bac62bf..682ea2a80 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); }