call 'set_tray_server_url' as soon as possible

This commit is contained in:
Jakub Trllo 2024-07-24 09:57:59 +02:00
parent 136da2b470
commit 131afb6684

View file

@ -164,13 +164,13 @@ def get_tray_server_url(
return None
def set_tray_server_url(tray_url: str, started: bool):
def set_tray_server_url(tray_url: Optional[str], started: bool):
"""Add tray server information file.
Called from tray logic, do not use on your own.
Args:
tray_url (str): Webserver url with port.
tray_url (Optional[str]): Webserver url with port.
started (bool): If tray is started. When set to 'False' it means
that tray is starting up.
@ -299,5 +299,12 @@ def main():
os.kill(pid, signal.SIGTERM)
remove_tray_server_url()
# Prepare the file with 'pid' information as soon as possible
try:
set_tray_server_url(None, False)
except TrayIsRunningError:
print("Tray is running")
sys.exit(1)
main()