Report a failure to compile as a start failure

This commit is contained in:
Kovid Goyal 2017-05-25 08:00:27 +05:30
parent db4ba63005
commit ad1c1e7575
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -80,6 +80,18 @@ class Server(object):
def serve_forever(self):
self.exception = None
from calibre.srv.content import reset_caches
try:
_df = os.environ.get('CALIBRE_DEVELOP_FROM', None)
if _df and os.path.exists(_df):
from calibre.utils.rapydscript import compile_srv
compile_srv()
except BaseException as e:
if self.start_failure_callback is not None:
try:
self.start_failure_callback(as_unicode(e))
except Exception:
pass
return
if self.state_callback is not None:
try:
self.state_callback(True)
@ -87,10 +99,6 @@ class Server(object):
pass
reset_caches() # we reset the cache as the server tdir has changed
try:
_df = os.environ.get('CALIBRE_DEVELOP_FROM', None)
if _df and os.path.exists(_df):
from calibre.utils.rapydscript import compile_srv
compile_srv()
self.loop.serve_forever()
except BaseException as e:
self.exception = e