daemon.run_gui: make sure to exit process on exception
previously, if GUI-related imports raised, the GUI would not start
but the process would not exit (e.g. asyncio event loop would go on)
Traceback (most recent call last):
File "...\electrum\electrum\daemon.py", line 517, in run_gui
gui = __import__('electrum.gui.' + gui_name, fromlist=['electrum'])
File "...\electrum\electrum\gui\qt\__init__.py", line 39, in <module>
from PyQt5.QtGui import QGuiApplication
ImportError: DLL load failed while importing QtGui: The specified module could not be found.
This commit is contained in:
@@ -513,11 +513,13 @@ class Daemon(Logger):
|
|||||||
if gui_name in ['lite', 'classic']:
|
if gui_name in ['lite', 'classic']:
|
||||||
gui_name = 'qt'
|
gui_name = 'qt'
|
||||||
self.logger.info(f'launching GUI: {gui_name}')
|
self.logger.info(f'launching GUI: {gui_name}')
|
||||||
gui = __import__('electrum.gui.' + gui_name, fromlist=['electrum'])
|
|
||||||
self.gui_object = gui.ElectrumGui(config, self, plugins)
|
|
||||||
try:
|
try:
|
||||||
|
gui = __import__('electrum.gui.' + gui_name, fromlist=['electrum'])
|
||||||
|
self.gui_object = gui.ElectrumGui(config, self, plugins)
|
||||||
self.gui_object.main()
|
self.gui_object.main()
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
self.logger.exception('')
|
self.logger.error(f'GUI raised exception: {repr(e)}. shutting down.')
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
# app will exit now
|
# app will exit now
|
||||||
self.on_stop()
|
self.on_stop()
|
||||||
|
|||||||
@@ -370,8 +370,13 @@ if __name__ == '__main__':
|
|||||||
if fd is not None:
|
if fd is not None:
|
||||||
plugins = init_plugins(config, config.get('gui', 'qt'))
|
plugins = init_plugins(config, config.get('gui', 'qt'))
|
||||||
d = daemon.Daemon(config, fd)
|
d = daemon.Daemon(config, fd)
|
||||||
d.run_gui(config, plugins)
|
try:
|
||||||
sys_exit(0)
|
d.run_gui(config, plugins)
|
||||||
|
except BaseException as e:
|
||||||
|
_logger.exception('daemon.run_gui errored')
|
||||||
|
sys_exit(1)
|
||||||
|
else:
|
||||||
|
sys_exit(0)
|
||||||
else:
|
else:
|
||||||
result = daemon.request(config, 'gui', (config_options,))
|
result = daemon.request(config, 'gui', (config_options,))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user