slightly better pyinstaller loader

This commit is contained in:
ed 2023-11-03 17:09:34 +00:00
parent 95566e8388
commit 7c1d97af3b

View file

@ -106,20 +106,19 @@ def meichk():
if filt not in sys.executable: if filt not in sys.executable:
filt = os.path.basename(sys.executable) filt = os.path.basename(sys.executable)
pids = [] hits = []
ptn = re.compile(r"^([^\s]+)\s+([0-9]+)")
try: try:
procs = sp.check_output("tasklist").decode("utf-8", "replace") cmd = "tasklist /fo csv".split(" ")
procs = sp.check_output(cmd).decode("utf-8", "replace")
except: except:
procs = "" # winpe procs = "" # winpe
for ln in procs.splitlines(): for ln in procs.split("\n"):
m = ptn.match(ln) if filt in ln.split('"')[:2][-1]:
if m and filt in m.group(1).lower(): hits.append(ln)
pids.append(int(m.group(2)))
mod = os.path.dirname(os.path.realpath(__file__)) mod = os.path.dirname(os.path.realpath(__file__))
if os.path.basename(mod).startswith("_MEI") and len(pids) == 2: if os.path.basename(mod).startswith("_MEI") and len(hits) == 2:
meicln(mod) meicln(mod)