mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-19 15:59:57 +00:00
try to catch windows shutdown so we exit properly and dont lose data
This commit is contained in:
parent
47cac3dc4a
commit
eb7db72965
@ -149,6 +149,14 @@ class DelugeGTK:
|
|||||||
import platform
|
import platform
|
||||||
if not platform.system() in ('Windows', 'Microsoft'):
|
if not platform.system() in ('Windows', 'Microsoft'):
|
||||||
signal.signal(signal.SIGHUP, self.manager.quit)
|
signal.signal(signal.SIGHUP, self.manager.quit)
|
||||||
|
else:
|
||||||
|
from win32api import SetConsoleCtrlHandler
|
||||||
|
from win32con import CTRL_CLOSE_EVENT
|
||||||
|
def win_handler(self, ctrl_type):
|
||||||
|
if ctrl_type == CTRL_CLOSE_EVENT:
|
||||||
|
self.shutdown()
|
||||||
|
SetConsoleCtrlHandler(win_handler)
|
||||||
|
|
||||||
self.dht_timer = 0
|
self.dht_timer = 0
|
||||||
self.dht_skip = False
|
self.dht_skip = False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user