From fb0066cbf0fb80742233f435c4bee622d4aa48c7 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 13 Aug 2024 05:54:19 -0700 Subject: [PATCH] fix: Handle KeyboardInterrupt in show_send_output_stream --- aider/coders/base_coder.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index ae0c7093f..e99276f9f 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -1259,9 +1259,9 @@ class Coder: yield from self.show_send_output_stream(completion) else: self.show_send_output(completion) - except KeyboardInterrupt: + except KeyboardInterrupt as kbi: self.keyboard_interrupt() - interrupted = True + raise kbi finally: self.io.log_llm_history( "LLM RESPONSE", @@ -1276,10 +1276,7 @@ class Coder: if args: self.io.ai_output(json.dumps(args, indent=4)) - if interrupted: - raise KeyboardInterrupt - - self.calculate_and_show_tokens_and_cost(messages, completion) + self.calculate_and_show_tokens_and_cost(messages, completion) def show_send_output(self, completion): if self.verbose: