Handle shutdown() better

This commit is contained in:
Andrew Resch 2009-05-20 20:11:57 +00:00
parent 447620f89f
commit 1d006e1368
1 changed files with 5 additions and 2 deletions

View File

@ -156,11 +156,14 @@ class Daemon(object):
component.start()
try:
reactor.run()
except KeyboardInterrupt:
self.shutdown()
finally:
self._shutdown()
@export()
def shutdown(self, *args, **kwargs):
reactor.callLater(0, reactor.stop)
def _shutdown(self, *args, **kwargs):
try:
os.remove(deluge.configmanager.get_config_dir("deluged.pid"))
except Exception, e: