PHP 8.2.30
Preview: __init__.py Size: 1015 B
/proc/thread-self/root/proc/self/root/opt/cloudlinux/venv/lib/python3.11/site-packages/cllimits/lib/__init__.py

# -*- coding: utf-8 -*-

# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT

import subprocess


def exec_utility(util_path, params, stderr=False):
    """
    Executes supplied utility with supplied parameters
    :param util_path: string with path to callable utility
    :param params: utility parameters
    :param stderr: trigger to return stderr or not
    :return: Cortege (ret_code, cagefsctl_stdout) if stderr is False
             Cortege (ret_code, cagefsctl_stdout, cagefsctl_stderr) otherwise
    """
    args = []
    args.append(util_path)
    args.extend(params)
    with subprocess.Popen(
        args,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        text=True,
    ) as proc:
        out, err = proc.communicate()
        retcode = proc.returncode
    if stderr:
        return retcode, out.strip(), err.strip()
    return retcode, out.strip()

Directory Contents

Dirs: 1 × Files: 4

Name Size Perms Modified Actions
- drwxr-xr-x 2026-04-09 07:00:48
Edit Download
15.99 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
50.63 KB lrw-r----- 2026-03-12 11:00:24
Edit Download
8.39 KB lrw-r--r-- 2026-03-12 11:00:24
Edit Download
1015 B lrw-r--r-- 2026-03-12 11:00:24
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).