Fix: Gracefully handle KeyboardInterrupt on exit.
This commit is contained in:
2
main.py
2
main.py
@@ -159,6 +159,8 @@ def main():
|
|||||||
else:
|
else:
|
||||||
console.print("[yellow]No new messages or an error occurred. Retrying...[/yellow]")
|
console.print("[yellow]No new messages or an error occurred. Retrying...[/yellow]")
|
||||||
time.sleep(5) # Wait 5 seconds before retrying on error
|
time.sleep(5) # Wait 5 seconds before retrying on error
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass # Exit gracefully on Ctrl+C
|
||||||
finally:
|
finally:
|
||||||
log_file.close()
|
log_file.close()
|
||||||
save_log = input(f"\nDo you want to save the chat log to {log_filename}? (y/n): ").lower()
|
save_log = input(f"\nDo you want to save the chat log to {log_filename}? (y/n): ").lower()
|
||||||
|
|||||||
Reference in New Issue
Block a user