ConsoleUI: quit command now gracefully handles stopping a stopped reactor
This commit is contained in:
parent
836acbf02b
commit
f077030dfc
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue