clean.do: cleanup *.tmp files that might have been left lying around.

...and fix a bug where builder.py can't handle it if its temp file is
deleted out from under it.
This commit is contained in:
Avery Pennarun 2010-12-11 21:10:57 -08:00
commit 49f0a041b2
2 changed files with 8 additions and 1 deletions

View file

@ -211,7 +211,13 @@ class BuildJob:
os.rename(self.tmpname2, t) os.rename(self.tmpname2, t)
os.unlink(self.tmpname1) os.unlink(self.tmpname1)
elif st1.st_size > 0: elif st1.st_size > 0:
os.rename(self.tmpname1, t) try:
os.rename(self.tmpname1, t)
except OSError, e:
if e.errno == errno.ENOENT:
unlink(t)
else:
raise
if st2: if st2:
os.unlink(self.tmpname2) os.unlink(self.tmpname2)
else: # no output generated at all; that's ok else: # no output generated at all; that's ok

View file

@ -6,3 +6,4 @@ fi
redo t/clean redo t/clean
rm -f *~ .*~ */*~ */.*~ *.pyc rm -f *~ .*~ */*~ */.*~ *.pyc
rm -rf t/.redo rm -rf t/.redo
find -name '*.tmp' -exec rm -fv {} \;