Warn if the temporary directory is not empty on cleanup

This commit is contained in:
Nikolaus Schulz 2010-07-16 17:47:25 +02:00
parent 4fb833176e
commit 573f2b9358
1 changed files with 7 additions and 2 deletions

View File

@ -160,8 +160,13 @@ class StaleFiles:
vprint("removing stale tempfile directory '%s'" % self.temp_dir)
try:
os.rmdir(self.temp_dir)
self.temp_dir = None
except (IOError, OSError): pass
except OSError, e:
if e.errno == errno.ENOTEMPTY: # Probably a bug
user_warning("cannot remove temporary directory '%s', "
"directory not empty" % self.temp_dir)
except IOError: pass
else: self.temp_dir = None
class Options: