Skip to content

Commit

Permalink
feat: add exit event tracking for Control-C and /exit commands
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Nov 30, 2024
1 parent c1c4193 commit 295040c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions aider/coders/base_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ def keyboard_interrupt(self):
thresh = 2 # seconds
if self.last_keyboard_interrupt and now - self.last_keyboard_interrupt < thresh:
self.io.tool_warning("\n\n^C KeyboardInterrupt")
self.event("exit", reason="Control-C")
sys.exit()

self.io.tool_warning("\n\n^C again to exit")
Expand Down
5 changes: 4 additions & 1 deletion aider/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@ def cmd_run(self, args, add_on_nonzero_exit=False):

def cmd_exit(self, args):
"Exit the application"
self.coder.event("exit", reason="/exit")
sys.exit()

def cmd_quit(self, args):
Expand Down Expand Up @@ -1085,7 +1086,9 @@ def cmd_voice(self, args):
self.io.tool_error("To use /voice you must provide an OpenAI API key.")
return
try:
self.voice = voice.Voice(audio_format=self.args.voice_format, device_name=self.args.voice_input_device)
self.voice = voice.Voice(
audio_format=self.args.voice_format, device_name=self.args.voice_input_device
)
except voice.SoundDeviceError:
self.io.tool_error(
"Unable to import `sounddevice` and/or `soundfile`, is portaudio installed?"
Expand Down

0 comments on commit 295040c

Please sign in to comment.