????
Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/clwizard/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clwizard/__pycache__/utils.cpython-311.opt-1.pyc |
� �ʘf: � � � d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ ddl m Z ddlmZ d dl Z edd �� � Zd � Zd� Zd� Zd � Zd� ZdS )� )�absolute_importN)�contextmanager)�Iterable� )�CRASH_LOG_PATH)�PackageMissingErrorTc # �� K � | dz } t |d� � 5 }|V � |r:|� � � t j |� � � � � ddd� � n# 1 swxY w Y t j || � � t j |� � dS # t t f$ r Y dS w xY w# t j |� � w # t t f$ r Y w w xY wxY w)z� Writeable file object that atomically updates a file (using a temporary file). :param filepath: the file path to be opened :param fsync: whether to force write the file to disk z.tmp�wN) �open�flush�os�fsync�fileno�rename�remove�IOError�OSError)�filepathr �tmppath�fs �py/clwizard/utils.py�atomic_writer sF � � � � ���G�� �'�3� � � %�1��G�G�G�� %���� � � ��������$�$�$� %� %� %� %� %� %� %� %� %� %� %���� %� %� %� %� � �'�8�$�$�$� ��I�g���������!� � � ��D�D� ����� ��I�g��������!� � � ��D� ������se �B5 �AA&�B5 �&A*�*B5 �-A*�.B5 �B �B2�1B2�5C#�7C�C#�C �C#�C � C#c �� � d� } t j � � D ]H} t |� � � � � }n# t j $ r Y �6w xY w | |� � r dS �IdS )zQ Detects if the process installing modules is running in the background. c �V � h d�t | � � k ph d�t | � � k S )N> �/usr/sbin/cloudlinux-wizard�install� --no-async> �/sbin/cloudlinux-wizardr r )�set)�cmdlines r �_is_wizard_cmdlinez9is_background_process_running.<locals>._is_wizard_cmdline2 s8 � � E�D�D��G���T� T�C�C�C�s�7�|�|�S� � TF)�psutil�process_iter�listr � NoSuchProcess)r! �procr s r �is_background_process_runningr( - s� � � � � � �#�%�%� � �� ��4�<�<�>�>�*�*�G�G���#� � � ��H� ������g�&�&� ��4�4� ��5s �!<�A� Ac � � t t j d� � }t t d� � }t j | |||�� � S )Nr )�stdin�stdout�stderr)r r �devnullr � subprocess�Popen)�cmd�fnull� log_crashs r �run_backgroundr3 G sH � ����S�!�!�E��^�S�)�)�I������� � � � r"