Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/support/lib
File: run_cmd.py
from typing import Union
[0] Fix | Delete
import os
[1] Fix | Delete
[2] Fix | Delete
is_exe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK)
[3] Fix | Delete
[4] Fix | Delete
[5] Fix | Delete
def cpuwatch_execv(args: list[str]):
[6] Fix | Delete
"""os.execv a command with cpuwatch"""
[7] Fix | Delete
cores = os.cpu_count()
[8] Fix | Delete
assert cores
[9] Fix | Delete
cmd = ["/usr/local/cpanel/bin/cpuwatch", str(cores)]
[10] Fix | Delete
cmd.extend(args)
[11] Fix | Delete
os.execv(cmd[0], cmd)
[12] Fix | Delete
[13] Fix | Delete
[14] Fix | Delete
def which(executable: str) -> Union[str, None]:
[15] Fix | Delete
for path in os.get_exec_path():
[16] Fix | Delete
full = os.path.join(path, executable)
[17] Fix | Delete
if is_exe(full):
[18] Fix | Delete
return full
[19] Fix | Delete
return None
[20] Fix | Delete
[21] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function