Run a specific command from the registry.
(self, command: str, data: dict[str, object])
| 275 | traceback.print_exception(*exc_info) |
| 276 | |
| 277 | def run_command(self, command: str, data: dict[str, object]) -> dict[str, object]: |
| 278 | """Run a specific command from the registry.""" |
| 279 | key = "cmd_" + command |
| 280 | method = getattr(self.__class__, key, None) |
| 281 | if method is None: |
| 282 | return {"error": f"Unrecognized command '{command}'"} |
| 283 | else: |
| 284 | if command not in {"check", "recheck", "run"}: |
| 285 | # Only the above commands use some error formatting. |
| 286 | del data["is_tty"] |
| 287 | del data["terminal_width"] |
| 288 | ret = method(self, **data) |
| 289 | assert isinstance(ret, dict) |
| 290 | return ret |
| 291 | |
| 292 | # Command functions (run in the server via RPC). |
| 293 |
no test coverage detected