Your IP : 216.73.216.172
�
$_$h�@ � �� � d dl mZ d dl mZ d dl mZ d dlZd dlZd dlZd dlZd dlZd dl Z d dl
Z
d dlZd dlmZ d dl
mZmZmZmZ d dlmZ d dlmZmZ d d lmZ d d
lmZ d dlmZmZmZ d dlm Z d d
l!m"Z" d dl#m$Z$ ddl%m&Z& ddl'm(Z( dZ)dZ*d8d�Z+d9d�Z,d� Z-d� Z.d� Z/d� Z0d� Z1d� Z2d� Z3d:d�Z4d8d�Z5d;d!�Z6d;d"�Z7d#� Z8d$� Z9d%� Z:d&� Z;d'� Z<d(� Z=d)� Z>d<d,�Z?d-� Z@d.� ZAd/� ZBd8d0�ZCd1eDd2eEfd3�ZFd4eDfd5�ZGd6� ZHd7� ZIdS )=� )�print_function)�absolute_import)�divisionN)�time)�AnyStr�List�Dict�Optional)�Path)�urlparse�
urlunparse)�resolve_username_and_doc_root)�CP_NAME)�NoDomain�NotSupported�
IncorrectData)�mod_makedirs)�init_sentry_client)�get_pkg_version� )�clprint)�ClSelectExceptz/sbin/cagefs_enter_userzehttps://9713d1296f804031b058b8f2d789d7ac:8ddacae32d8246cf8b25cf826bf3fc0a@cl.sentry.cloudlinux.com/12c � � t j | t d� � t j t j d|d�� � }|� � � \ }}nA# t t f$ r-}t j | d t |� � � � �d}~ww xY w|j dk r/t j |pdd�
| � � �d|��� � �|S ) z�
Runs external process and returns output
:param cmd: command and arguments as a list
:param env_data
:return string
� /dev/nullT)�stdin�stdout�stderr� close_fds�env�textr Nzoutput of the command: � �
)�
subprocess�Popen�open�PIPE�STDOUT�communicate�OSError�IOErrorr �FileProcessError�str�
returncode�ExternalProgramFailed�join)�cmd�env_data�output�std_out�std_err�es �E/opt/cloudlinux/venv/lib64/python3.11/site-packages/clselect/utils.py�run_commandr7 ( s� � �>��!���{�#�#��?��$����
�
�
�� "�-�-�/�/�������W�� >� >� >��-�c�!�f�c�!�f�f�=�=�=�����>����
��A����2��Q�Q�#�(�(�3�-�-�-�-���Q�
�
�
� �Ns �AA �B�'(B�Bc
�D � t j | t d� � t j t j |d||�� � }|� � � \ }}nA# t
t f$ r-}t j | d t |� � � � �d}~ww xY w|j
||fS )a�
Runs external process and returns output.
Differs from subprocess.check_output, run_command above, and check_output below in that it does not
throw an exception if process's return code != 0
:param cmd: command and arguments as a list
:param env_data
:param preexec_fn: Pre-exec function. None if don't need
:param cwd: Directory name to set as current
:return Cortege: (ret_code, stdout, stderr)
r T)r r r �
preexec_fnr �cwdr r N)r# r$ r% r&