diff --git a/src/watchdog/events.py b/src/watchdog/events.py index db2c92ac9..162130e4f 100755 --- a/src/watchdog/events.py +++ b/src/watchdog/events.py @@ -351,6 +351,7 @@ def dispatch(self, event): EVENT_TYPE_DELETED: self.on_deleted, EVENT_TYPE_MODIFIED: self.on_modified, EVENT_TYPE_MOVED: self.on_moved, + EVENT_TYPE_CLOSED: self.on_closed, }[event.event_type](event) def on_any_event(self, event): @@ -398,6 +399,16 @@ def on_modified(self, event): :class:`DirModifiedEvent` or :class:`FileModifiedEvent` """ + def on_closed(self, event): + """Called when a file opened for reading or writing is closed. + + :param event: + Event representing file closing. + :type event: + :class:`FileClosedEvent` + :return: + """ + class PatternMatchingEventHandler(FileSystemEventHandler): """ diff --git a/src/watchdog/observers/inotify_c.py b/src/watchdog/observers/inotify_c.py index 040224356..3eceb35bd 100644 --- a/src/watchdog/observers/inotify_c.py +++ b/src/watchdog/observers/inotify_c.py @@ -142,6 +142,8 @@ class InotifyConstants(object): InotifyConstants.IN_DELETE, InotifyConstants.IN_DELETE_SELF, InotifyConstants.IN_DONT_FOLLOW, + InotifyConstants.IN_CLOSE_WRITE, + InotifyConstants.IN_CLOSE_NOWRITE, ])