mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
python improvements
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user