pyinotify: be sure possible IOError/OSError by remove monitor (log-rotate? normally not raises) are handled properly.

pull/1867/head
sebres 2017-08-16 11:37:22 +02:00
parent 7867228146
commit e5169d8f84
1 changed files with 6 additions and 0 deletions

View File

@ -231,6 +231,9 @@ class FilterPyinotify(FileFilter):
return True
except KeyError: # pragma: no cover
pass
# EnvironmentError is parent of IOError, OSError, etc.
except EnvironmentError as e: # pragma: no cover (normally unreached)
logSys.error("Remove file monitor for %s causes %s", path, e)
return False
def _addDirWatcher(self, path_dir):
@ -249,6 +252,9 @@ class FilterPyinotify(FileFilter):
self.__monitor.rm_watch(wdInt)
except KeyError: # pragma: no cover
pass
# EnvironmentError is parent of IOError, OSError, etc.
except EnvironmentError as e: # pragma: no cover (normally unreached)
logSys.error("Remove monitor for the parent directory %s causes %s", path_dir, e)
logSys.debug("Removed monitor for the parent directory %s", path_dir)
##