Change CommandMessage.command from Command instance to command's name.
[hooke.git] / hooke / hooke.py
index b16a800c738005b2e3ecc50079430f914daad8da..cf6600ed8714fc8e6b4916a317935d79bb3e5a61 100644 (file)
@@ -107,6 +107,8 @@ class Hooke (object):
         self.commands = []
         for plugin in self.plugins:
             self.commands.extend(plugin.commands())
+        self.command_by_name = dict(
+            [(c.name, c) for c in self.commands])
 
     def load_drivers(self):
         self.drivers = plugin_mod.load_graph(
@@ -170,7 +172,7 @@ class HookeRunner (object):
     def _cleanup_run(self, ui_to_command, command_to_ui, command):
         log = logging.getLogger('hooke')
         log.debug('cleanup sending CloseEngine')
-        ui_to_command.put(ui.CloseEngine())
+        ui_to_command.put(engine.CloseEngine())
         hooke = None
         while not isinstance(hooke, Hooke):
             log.debug('cleanup waiting for Hooke instance from the engine.')