Validate directory before watching it with inotify

Fixes this exception that is raised when the inotify-based reloader is used in
combination with the `--chdir` option:

    inotify.calls.InotifyError: Call failed (should not be -1): (-1) ERRNO=(0)
This commit is contained in:
Stanis Trendelenburg 2020-02-02 22:58:31 +01:00
parent 27d1e9887a
commit f39b065d4b

View File

@ -104,7 +104,8 @@ if has_inotify:
self._dirs = self.get_dirs()
for dirname in self._dirs:
self._watcher.add_watch(dirname, mask=self.event_mask)
if os.path.isdir(dirname):
self._watcher.add_watch(dirname, mask=self.event_mask)
for event in self._watcher.event_gen():
if event is None: