Skip to content

The only downloader you need. 下载器的集大成者。

Fix #375

XiaoYouChRc4899424c0e8
diff --git a/app/supports/application.py b/app/supports/application.py
index 1ea238b7..ac0f0dc3 100644
--- a/app/supports/application.py
+++ b/app/supports/application.py
@@ -1,3 +1,4 @@
+from signal import signal, SIGINT
import sys
import traceback
from time import localtime, strftime, time
@@ -63,6 +64,15 @@ class SingletonApplication(QApplication):
if "__compiled__" in globals(): # 编译后的错误捕捉
sys.excepthook = exceptionHook
+ try:
+ signal(SIGINT, self._handleInterruptSignal)
+ except Exception as e:
+ logger.warning(f"Failed to register SIGINT handler: {e}")
+
+ def _handleInterruptSignal(self, _signum, _frame):
+ logger.error("KeyboardInterrupt, quitting application")
+ self.quit()
+
# exit: cleanup shared memory
def exec(self):
try: