Fix Local Agent 1.13.1 Windows dashboard startup
This commit is contained in:
@@ -35,13 +35,48 @@ def _popup(title: str, message: str, error: bool = False) -> None:
|
||||
def _pid_alive(pid: int) -> bool:
|
||||
if pid <= 0:
|
||||
return False
|
||||
|
||||
if os.name == "nt":
|
||||
try:
|
||||
import ctypes
|
||||
|
||||
PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
|
||||
STILL_ACTIVE = 259
|
||||
|
||||
kernel32 = ctypes.windll.kernel32
|
||||
|
||||
handle = kernel32.OpenProcess(
|
||||
PROCESS_QUERY_LIMITED_INFORMATION,
|
||||
False,
|
||||
int(pid),
|
||||
)
|
||||
|
||||
if not handle:
|
||||
return False
|
||||
|
||||
try:
|
||||
exit_code = ctypes.c_ulong()
|
||||
|
||||
if not kernel32.GetExitCodeProcess(
|
||||
handle,
|
||||
ctypes.byref(exit_code),
|
||||
):
|
||||
return False
|
||||
|
||||
return exit_code.value == STILL_ACTIVE
|
||||
|
||||
finally:
|
||||
kernel32.CloseHandle(handle)
|
||||
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
try:
|
||||
os.kill(pid, 0)
|
||||
return True
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def _supervisor_running() -> bool:
|
||||
try:
|
||||
if not SUPERVISOR_LOCK.exists():
|
||||
|
||||
Reference in New Issue
Block a user