From 07f2f6f910d8ab879aace2e904058ea0e76cc76f Mon Sep 17 00:00:00 2001 From: neko Date: Wed, 22 Jan 2025 14:01:38 +0500 Subject: [PATCH] Fix automatic unoserver restart --- main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index f14998a..2047aaa 100644 --- a/main.py +++ b/main.py @@ -4,6 +4,7 @@ import asyncio import subprocess from pathlib import Path import shutil +import time # api_id = #api_hash = "" @@ -57,9 +58,12 @@ def unoCheck(): # Check if unoserver even exists def unoStart(): unoserverPath = unoCheck() if unoserverPath: - retval = 1 - while retval != 0: - subprocess.Popen(args=[unoserverPath, "--daemon"]) + while True: + process = subprocess.Popen(args=[unoserverPath, "--daemon"]) + retval = process.wait() + if retval == 0: + break + time.sleep(1) else: return