Attempt to work-around watchdog bug

This commit is contained in:
Jean-Paul Calderone 2019-03-07 11:42:12 -05:00
parent e0b7919ad8
commit 35fc563a6f
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,16 @@
"""
Hotfix for https://github.com/gorakhargosh/watchdog/issues/541
"""
from watchdog.observers.fsevents import FSEventsEmitter
# The class object has already been bundled up in the default arguments to
# FSEventsObserver.__init__. So mutate the class object (instead of replacing
# it with a safer version).
original_on_thread_stop = FSEventsEmitter.on_thread_stop
def safe_on_thread_stop(self):
if self.is_alive():
return original_on_thread_stop(self)
def patch():
FSEventsEmitter.on_thread_stop = safe_on_thread_stop

View File

@ -53,6 +53,9 @@ from ..util.eliotutil import (
validateInstanceOf,
)
import ._watchdog_541
_watchdog_541.patch()
NOT_STARTED = "NOT_STARTED"
STARTED = "STARTED"
STOPPING = "STOPPING"