Handle ctrl+c safely for a clean exit #5

Closed
opened 2025-06-07 18:14:40 +00:00 by LunaChocken · 1 comment
Owner
No description provided.
LunaChocken added this to the Main project 2025-06-07 18:14:40 +00:00
LunaChocken moved this to General in Main on 2025-06-07 18:14:42 +00:00
Author
Owner

Exits without spamming errors

def prompt_game(self, text, default="None"):
        try:
            response = pt.prompt(text, completer=self.completer, complete_while_typing=True)
        except KeyboardInterrupt:
            print("\nCtrl+C received. Exiting.")
            sys.exit(0)```
Exits without spamming errors ```python def prompt_game(self, text, default="None"): try: response = pt.prompt(text, completer=self.completer, complete_while_typing=True) except KeyboardInterrupt: print("\nCtrl+C received. Exiting.") sys.exit(0)```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LunaChocken/SteamPathCLI#5