HEX
Server: Apache
System: Linux ecres233.servconfig.com 4.18.0-553.94.1.lve.el8.x86_64 #1 SMP Thu Jan 22 12:37:22 UTC 2026 x86_64
User: gonnelllaw (9952)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: //opt/support/lib/run_cmd.py
import os

is_exe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK)


def cpuwatch_execv(args: list[str]):
    """os.execv a command with cpuwatch"""
    cores = os.cpu_count()
    assert cores
    cmd = ["/usr/local/cpanel/bin/cpuwatch", str(cores)]
    cmd.extend(args)
    os.execv(cmd[0], cmd)


def which(executable: str) -> str | None:
    for path in os.get_exec_path():
        full = os.path.join(path, executable)
        if is_exe(full):
            return full
    return None