Skip to content

Commit

Permalink
allow keyboard interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixthrush committed Nov 18, 2024
1 parent 166bd5e commit 7177ef7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/aniworld/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,13 @@ def process_url(url):
logging.debug("Set update_directory_visibility as callback for action_selector")

def setup_signal_handling(self):
def signal_handler():
logging.info("SIGINT received. Cleaning up and exiting...")
def signal_handler(_signal_number, _frame):
try:
self.parentApp.switchForm(None)
except AttributeError:
pass
self.cancel_timer()
self.parentApp.setNextForm(None)
self.parentApp.switchFormNow()
sys.exit()

signal.signal(signal.SIGINT, signal_handler)
logging.debug("Signal handler for SIGINT registered")
Expand Down

0 comments on commit 7177ef7

Please sign in to comment.