Fix automatic unoserver restart

This commit is contained in:
neko 2025-01-22 14:01:38 +05:00
parent e31ccfee3a
commit 07f2f6f910
1 changed files with 7 additions and 3 deletions

10
main.py
View File

@ -4,6 +4,7 @@ import asyncio
import subprocess import subprocess
from pathlib import Path from pathlib import Path
import shutil import shutil
import time
# api_id = # api_id =
#api_hash = "" #api_hash = ""
@ -57,9 +58,12 @@ def unoCheck(): # Check if unoserver even exists
def unoStart(): def unoStart():
unoserverPath = unoCheck() unoserverPath = unoCheck()
if unoserverPath: if unoserverPath:
retval = 1 while True:
while retval != 0: process = subprocess.Popen(args=[unoserverPath, "--daemon"])
subprocess.Popen(args=[unoserverPath, "--daemon"]) retval = process.wait()
if retval == 0:
break
time.sleep(1)
else: else:
return return