Fix AttributeError when webserver isn't enabled.

This commit is contained in:
Tehom 2017-06-03 21:57:11 -04:00
parent 94376257a4
commit ccfbe06ded

View file

@ -174,8 +174,11 @@ class Evennia(object):
# (see https://github.com/evennia/evennia/issues/1128)
def _wrap_sigint_handler(*args):
from twisted.internet.defer import Deferred
d = self.web_root.empty_threadpool()
d.addCallback(lambda _: self.shutdown(_reactor_stopping=True))
if WEBSERVER_ENABLED:
d = self.web_root.empty_threadpool()
d.addCallback(lambda _: self.shutdown(_reactor_stopping=True))
else:
d = Deferred(lambda _: self.shutdown(_reactor_stopping=True))
d.addCallback(lambda _: reactor.stop())
reactor.callLater(1, d.callback, None)
reactor.sigInt = _wrap_sigint_handler