From 8e1d791d0c518388d16f147b875398c5197c364b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 26 Oct 2016 13:39:43 +0200 Subject: [PATCH] Truncate the log just before starting the remote build This gets rid of all those remote substitution messages that were polluting the build logs. --- src/hydra-queue-runner/build-remote.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index d21ab9d7..15c234f3 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -136,8 +136,6 @@ void State::buildRemote(ref destStore, Child child; openConnection(machine, tmpDir, logFD.get(), child); - logFD = -1; - FdSource from(child.from.get()); FdSink to(child.to.get()); @@ -223,6 +221,16 @@ void State::buildRemote(ref destStore, autoDelete.cancel(); + /* Truncate the log to get rid of messages about substitutions + etc. on the remote system. */ + if (lseek(logFD.get(), SEEK_SET, 0) != 0) + throw SysError("seeking to the start of log file ‘%s’", result.logFile); + + if (ftruncate(logFD.get(), 0) == -1) + throw SysError("truncating log file ‘%s’", result.logFile); + + logFD = -1; + /* Do the build. */ printMsg(lvlDebug, format("building ‘%1%’ on ‘%2%’") % step->drvPath % machine->sshName);