Re-enable daemon running in the background in flatpak

This commit is contained in:
Bernd Schoolmann 2024-02-09 15:04:32 +01:00
parent 75982ad322
commit 39d1ec6980
No known key found for this signature in database
2 changed files with 10 additions and 10 deletions

View File

@ -32,6 +32,7 @@ def main():
reply = the_interface.settings() reply = the_interface.settings()
exit() exit()
goldwarden.run_daemon_background(token)
# start daemons # start daemons
dbus_autofill_monitor.run_daemon(token) # todo: remove after migration dbus_autofill_monitor.run_daemon(token) # todo: remove after migration
dbus_monitor.run_daemon(token) dbus_monitor.run_daemon(token)

View File

@ -178,17 +178,16 @@ def run_daemon(token):
print("starting goldwarden daemon", BINARY_PATH, token) print("starting goldwarden daemon", BINARY_PATH, token)
# print while running # print while running
result = subprocess.Popen([f"{BINARY_PATH}", "daemonize"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, env=daemon_env) result = subprocess.Popen([f"{BINARY_PATH}", "daemonize"], stdout=subprocess.PIPE, text=True, env=daemon_env)
if result.returncode != 0:
print("Failed err", result.stderr)
raise Exception("Failed to start daemon")
# log stdout and stderr to file # write log to file until process exits
with open(f"{log_directory}/daemon.log", "w") as f: log_file = open(f"{log_directory}/daemon.log", "w")
f.write(result.stdout.read()) while result.poll() == None:
f.write(result.stderr.read()) # read stdout and stder
stdout = result.stdout.readline()
result.wait() log_file.write(stdout)
log_file.flush()
log_file.close()
print("quitting goldwarden daemon") print("quitting goldwarden daemon")
return result.returncode return result.returncode