ConsoleUI: quit command now gracefully handles stopping a stopped reactor

This commit is contained in:
Calum Lind 2013-05-16 02:37:06 +01:00
parent 836acbf02b
commit f077030dfc
1 changed files with 5 additions and 2 deletions

View File

@ -35,7 +35,7 @@
# #
from deluge.ui.client import client from deluge.ui.client import client
from deluge.ui.console.main import BaseCommand from deluge.ui.console.main import BaseCommand
from twisted.internet import reactor from twisted.internet import reactor, error
class Command(BaseCommand): class Command(BaseCommand):
"""Exit from the client.""" """Exit from the client."""
@ -47,4 +47,7 @@ class Command(BaseCommand):
reactor.stop() reactor.stop()
return client.disconnect().addCallback(on_disconnect) return client.disconnect().addCallback(on_disconnect)
else: else:
reactor.stop() try:
reactor.stop()
except error.ReactorNotRunning:
pass