Unloading conflicting plugin before crashing
This commit is contained in:
parent
fb2c243255
commit
fd7ad82e2f
@ -28,18 +28,19 @@ class PluginRepository:
|
|||||||
# create instance
|
# create instance
|
||||||
plugin_instance = self._registered_plugins[plugin]() # config is statically loaded
|
plugin_instance = self._registered_plugins[plugin]() # config is statically loaded
|
||||||
|
|
||||||
# store instance
|
|
||||||
self._loaded_plugins[plugin] = plugin_instance
|
|
||||||
|
|
||||||
# load compilers
|
# load compilers
|
||||||
compilers = plugin_instance.load_compilers()
|
compilers = plugin_instance.load_compilers()
|
||||||
|
|
||||||
if set(compilers.keys()).intersection(self._command_compilers.keys()):
|
if set(compilers.keys()).intersection(self._command_compilers.keys()):
|
||||||
|
plugin_instance.close() # The program should stop at this point anyways
|
||||||
raise ConflictingPlugins(f"Conflicting plugin is tried to be loaded: {plugin}")
|
raise ConflictingPlugins(f"Conflicting plugin is tried to be loaded: {plugin}")
|
||||||
|
|
||||||
# Store commands
|
# Store commands
|
||||||
self._command_compilers.update(compilers)
|
self._command_compilers.update(compilers)
|
||||||
|
|
||||||
|
# store instance
|
||||||
|
self._loaded_plugins[plugin] = plugin_instance
|
||||||
|
|
||||||
# log stuff
|
# log stuff
|
||||||
self._logger.info(f"Loaded plugin: {plugin}")
|
self._logger.info(f"Loaded plugin: {plugin}")
|
||||||
self._logger.debug(f"Plugin {plugin} loaded the following commands: {', '.join(compilers.keys())}")
|
self._logger.debug(f"Plugin {plugin} loaded the following commands: {', '.join(compilers.keys())}")
|
||||||
|
Loading…
Reference in New Issue
Block a user