[Buildbot-commits] buildbot/buildbot/slave commands.py,1.57,1.58

Brian Warner warner at users.sourceforge.net
Sun Aug 6 22:37:22 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot/slave
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12486/buildbot/slave

Modified Files:
	commands.py 
Log Message:
[project @ LogFileWatcher: survive logfiles which aren't around at startup correctly]

Original author: warner at lothar.com
Date: 2006-08-06 22:34:59

Index: commands.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/commands.py,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- commands.py	6 Aug 2006 02:49:34 -0000	1.57
+++ commands.py	6 Aug 2006 22:37:20 -0000	1.58
@@ -162,11 +162,16 @@
         self.poller = task.LoopingCall(self.poll)
 
     def start(self):
-        self.poller.start(self.POLL_INTERVAL)
+        self.poller.start(self.POLL_INTERVAL).addErrback(self._cleanupPoll)
+
+    def _cleanupPoll(self, err):
+        log.err(err, msg="Polling error")
+        self.poller = None
 
     def stop(self):
         self.poll()
-        self.poller.stop()
+        if self.poller is not None:
+            self.poller.stop()
 
     def statFile(self):
         if os.path.exists(self.logfile):
@@ -179,6 +184,12 @@
             s = self.statFile()
             if s == self.old_logfile_stats:
                 return # not started yet
+            if not s:
+                # the file was there, but now it's deleted. Forget about the
+                # initial state, clearly the process has deleted the logfile
+                # in preparation for creating a new one.
+                self.old_logfile_stats = None
+                return # no file to work with
             self.f = open(self.logfile, "rb")
             self.started = True
         while True:





More information about the Commits mailing list