[Buildbot-commits] buildbot/buildbot/status builder.py,1.39,1.40
Brian Warner
warner at users.sourceforge.net
Mon Nov 8 21:19:41 UTC 2004
Update of /cvsroot/buildbot/buildbot/buildbot/status
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2182/buildbot/status
Modified Files:
builder.py
Log Message:
(BuilderStatus.saveYourself): w32 can't do os.rename() onto an existing file,
so catch the exception and unlink the target file first. This introduces a
slight window where the existing file could be lost, but the main failure
case (disk full) should still be handled safely.
(BuildStatus.saveYourself): same
Index: builder.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/builder.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- builder.py 15 Oct 2004 16:59:44 -0000 1.39
+++ builder.py 8 Nov 2004 21:19:39 -0000 1.40
@@ -757,7 +757,12 @@
tmpfilename = filename + ".tmp"
try:
pickle.dump(self, open(tmpfilename, "w"), -1)
- os.rename(tmpfilename, filename)
+ try:
+ os.rename(tmpfilename, filename)
+ except OSError:
+ # windows cannot rename a file on top of an existing one
+ os.unlink(filename)
+ os.rename(tmpfilename, filename)
except Exception, e:
log.msg("unable to save build %s-#%d" % (self.builder.name,
self.number))
@@ -843,7 +848,12 @@
tmpfilename = filename + ".tmp"
try:
pickle.dump(self, open(tmpfilename, "w"), -1)
- os.rename(tmpfilename, filename)
+ try:
+ os.rename(tmpfilename, filename)
+ except OSError:
+ # windows cannot rename a file on top of an existing one
+ os.unlink(filename)
+ os.rename(tmpfilename, filename)
except Exception, e:
log.msg("unable to save builder %s" % self.name)
log.err()
More information about the Commits
mailing list