Skip to content

Commit

Permalink
return from InotifyEmitter.queue_events() if not launched when thread…
Browse files Browse the repository at this point in the history
… is inactive (#963)

* return from InotifyEmitter.queue_events() if not launched when thread is inactive

* add logging

* Update inotify.py
  • Loading branch information
altendky authored Mar 14, 2023
1 parent 5400b1f commit e716122
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/watchdog/observers/inotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"""

import logging
import os
import threading
from .inotify_buffer import InotifyBuffer
Expand Down Expand Up @@ -91,6 +92,9 @@
)


logger = logging.getLogger(__name__)


class InotifyEmitter(EventEmitter):
"""
inotify(7)-based event emitter.
Expand Down Expand Up @@ -124,6 +128,9 @@ def on_thread_stop(self):
def queue_events(self, timeout, full_events=False):
# If "full_events" is true, then the method will report unmatched move events as separate events
# This behavior is by default only called by a InotifyFullEmitter
if self._inotify is None:
logger.error("InotifyEmitter.queue_events() called when the thread is inactive")
return
with self._lock:
event = self._inotify.read_event()
if event is None:
Expand Down

0 comments on commit e716122

Please sign in to comment.