aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2010-07-16 17:47:25 +0200
committerNikolaus Schulz <microschulz@web.de>2010-07-19 01:40:25 +0200
commit573f2b9358cacf596b1fda6807f91b86bc5b7b34 (patch)
treed48322b1f456e35928414824944ce455a637a449
parent4fb833176e9af7eaba801fdad14c3f3f174c4316 (diff)
downloadarchivemail-573f2b9358cacf596b1fda6807f91b86bc5b7b34.tar.gz
archivemail-573f2b9358cacf596b1fda6807f91b86bc5b7b34.tar.bz2
archivemail-573f2b9358cacf596b1fda6807f91b86bc5b7b34.zip
Warn if the temporary directory is not empty on cleanup
-rwxr-xr-xarchivemail.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/archivemail.py b/archivemail.py
index 4adf6b1..f570456 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -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: