Merge pull request #1334 from TehomCD/webroot_attr_error_fix

Fix AttributeError when webserver isn't enabled.
This commit is contained in:
Griatch 2017-06-04 09:13:18 +02:00 committed by GitHub
commit cbf2e44dc8

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