From b955a570fd014003be95ef563f24b60acc84840b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 9 Mar 2018 09:50:13 +0100 Subject: [PATCH] Fix DirectoryMonitor.stop() raising unhandled KeyError on rm -rf workdir --- lib/tfw/components/source_code_event_handler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tfw/components/source_code_event_handler.py b/lib/tfw/components/source_code_event_handler.py index 65232d2..4915887 100644 --- a/lib/tfw/components/source_code_event_handler.py +++ b/lib/tfw/components/source_code_event_handler.py @@ -71,7 +71,9 @@ class SourceCodeEventHandler(TriggerlessEventHandler): return self._monitor def reload_monitor(self): - if self._monitor: self._monitor.stop() + if self._monitor: + try: self._monitor.stop() + except KeyError: logging.debug('Working directory was removed – ignoring...') self._monitor = DirectoryMonitor(self.filemanager.workdir) self._monitor.watch() # This runs on a separate thread