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
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