From 449cbf507f69441a79e9a6a9bf0fb224ebbaaa55 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 20 May 2024 10:22:31 -0700 Subject: [PATCH] Allow test_cmd to be a callable --- aider/commands.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/aider/commands.py b/aider/commands.py index 7641bebf5..3e6e8a724 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -535,7 +535,15 @@ class Commands: def cmd_test(self, args): "Run a shell command and add the output to the chat on non-zero exit code" - return self.cmd_run(args, True) + if not callable(args): + return self.cmd_run(args, True) + + errors = args() + if not errors: + return + + self.io.tool_error(errors, strip=False) + return errors def cmd_run(self, args, add_on_nonzero_exit=False): "Run a shell command and optionally add the output to the chat (alias: !)"