Skip to content

Commit

Permalink
clean.do: cleanup *.tmp files that might have been left lying around.
Browse files Browse the repository at this point in the history
...and fix a bug where builder.py can't handle it if its temp file is
deleted out from under it.
  • Loading branch information
apenwarr committed Dec 12, 2010
1 parent b998743 commit 49f0a04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion builder.py
Expand Up @@ -211,7 +211,13 @@ def _after1(self, t, rv):
os.rename(self.tmpname2, t)
os.unlink(self.tmpname1)
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:
os.unlink(self.tmpname2)
else: # no output generated at all; that's ok
Expand Down
1 change: 1 addition & 0 deletions clean.do
Expand Up @@ -6,3 +6,4 @@ fi
redo t/clean
rm -f *~ .*~ */*~ */.*~ *.pyc
rm -rf t/.redo
find -name '*.tmp' -exec rm -fv {} \;

0 comments on commit 49f0a04

Please sign in to comment.