python improvements

This commit is contained in:
F. Duncanh
2025-11-03 02:40:57 -05:00
parent 5489305031
commit bdd82f621d
2 changed files with 4 additions and 0 deletions

View File

@@ -265,9 +265,11 @@ def check_file_exists(file_path):
data = file.read(4)
pid = struct.unpack('<I', data)[0]
if not pid_is_running(pid):
file.close()
test = False
else :
data = file.read()
file.close()
pname = data.split(b'\0',1)[0].decode('utf-8')
last_element_of_pname = os.path.basename(pname)
test = check_process_name(pid, last_element_of_pname)

View File

@@ -163,9 +163,11 @@ def check_file_exists(file_path):
data = file.read(4)
pid = struct.unpack('<I', data)[0]
if not pid_is_running(pid):
file.close()
test = False
else:
data = file.read()
file.close()
pname = data.split(b'\0',1)[0].decode('utf-8')
last_element_of_pname = os.path.basename(pname)
test = check_process_name(pid, last_element_of_pname)