Skip to content

Commit

Permalink
[gnu/linux] Fix ability to catch IN_CLOSE_WRITE, IN_CLOSE_NOWRITE eve…
Browse files Browse the repository at this point in the history
  • Loading branch information
ysard committed Jan 13, 2021
1 parent db45bb7 commit c66c556
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/watchdog/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
"""
Expand Down
2 changes: 2 additions & 0 deletions src/watchdog/observers/inotify_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
])


Expand Down

0 comments on commit c66c556

Please sign in to comment.