Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param bool stop_daemon: If ``True``, the sync daemon will be stopped when
quitting the GUI, if ``False``, it will be kept alive. If ``None``, the daemon
will only be stopped if it was started by the GUI (default).
"""
logger.info("Quitting...")
if stop_daemon is None:
stop_daemon = self._started
# stop update timer to stop communication with daemon
self.update_ui_timer.stop()
# stop sync daemon if we started it or ``stop_daemon==True``
if stop_daemon and self.mdbx and not IS_MACOS_BUNDLE:
self.mdbx._pyroRelease()
stop_maestral_daemon_process(CONFIG_NAME)
# quit
self.deleteLater()
QtCore.QCoreApplication.quit()
sys.exit(0)
def stop_daemon_with_cli_feedback(config_name):
"""Wrapper around `daemon.stop_maestral_daemon_process`
with command line feedback."""
from maestral.sync.daemon import stop_maestral_daemon_process
click.echo("Stopping Maestral...", nl=False)
success = stop_maestral_daemon_process(config_name)
if success is None:
click.echo("Maestral daemon was not running.")
elif success is True:
click.echo("\rStopping Maestral... " + OK)
else:
click.echo("\rStopping Maestral... " + KILLED)