Skip to content

Commit 38e9539

Browse files
author
arch
committed
add function to check if process is running
1 parent d5fd54c commit 38e9539

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

contrib/Installer/mtfg-ofs-extension-installer.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import time
99
import traceback
1010
import shutil
11+
import subprocess
1112

1213
from packaging import version
1314
from bs4 import BeautifulSoup # beautifulsoup4
@@ -78,6 +79,13 @@ def get_download_urls_with_api():
7879
error("Download URL not found (" + LATEST_RELEASE_API_URL + ")")
7980

8081

82+
def process_exists(process_name):
83+
call = 'TASKLIST', '/FI', 'imagename eq %s' % process_name
84+
output = subprocess.check_output(call).decode()
85+
last_line = output.strip().split('\r\n')[-1]
86+
return last_line.lower().startswith(process_name.lower())
87+
88+
8189
def is_latest_version_installed(version_file, version):
8290
if os.path.exists(version_file):
8391
with open(version_file, 'r') as f:

0 commit comments

Comments
 (0)