Fix DirectoryMonitor.stop() raising unhandled KeyError on rm -rf workdir

This commit is contained in:
Kristóf Tóth 2018-03-09 09:50:13 +01:00
parent 0e4be3c22f
commit b955a570fd

View File

@ -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