관리-도구
편집 파일: subprocess.cpython-312.opt-1.pyc
� �Q�f9 � �2 � d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ej Z ej Z ej Z G d � d ej ej � Z G d� d� Zdddej fd �Zdddej d�d�Zy))�create_subprocess_exec�create_subprocess_shell� N� )�events)� protocols)�streams)�tasks)�loggerc �L � � e Zd ZdZ� fd�Zd� Zd� Zd� Zd� Zd� Z d� Z d � Z� xZS ) �SubprocessStreamProtocolz0Like StreamReaderProtocol, but for a subprocess.c �� �� t �| � |�� || _ d x| _ x| _ | _ d | _ d| _ g | _ | j j � | _ y )N)�loopF)�super�__init__�_limit�stdin�stdout�stderr� _transport�_process_exited� _pipe_fds�_loop� create_future� _stdin_closed)�self�limitr � __class__s ��9/opt/alt/python312/lib64/python3.12/asyncio/subprocess.pyr z!SubprocessStreamProtocol.__init__ sZ �� � ���d��#����15�5�� �5�T�[�4�;����$������!�Z�Z�5�5�7��� c �l � | j j g}| j �|j d| j ��� | j �|j d| j ��� | j �|j d| j ��� dj dj |� � S )Nzstdin=zstdout=zstderr=z<{}>� )r �__name__r �appendr r �format�join)r �infos r �__repr__z!SubprocessStreamProtocol.__repr__ s� � ����'�'�(���:�:�!��K�K�&�����/�0��;�;�"��K�K�'�$�+�+��1�2��;�;�"��K�K�'�$�+�+��1�2��}�}�S�X�X�d�^�,�,r c �n � || _ |j d� }|�ft j | j | j �� | _ | j j |� | j j d� |j d� }|�ft j | j | j �� | _ | j j |� | j j d� |j d� }|�)t j || d | j �� | _ y y )Nr �r r � r )�protocol�readerr ) r �get_pipe_transportr �StreamReaderr r r � set_transportr r# r �StreamWriterr )r � transport�stdout_transport�stderr_transport�stdin_transports r �connection_madez(SubprocessStreamProtocol.connection_made( s� � �#���$�7�7��:���'�!�.�.�T�[�[�48�J�J�@�D�K��K�K�%�%�&6�7��N�N�!�!�!�$�$�7�7��:���'�!�.�.�T�[�[�48�J�J�@�D�K��K�K�%�%�&6�7��N�N�!�!�!�$�#�6�6�q�9���&� �-�-�o�7;�59�37�:�:�?�D�J� 'r c �x � |dk( r | j }n|dk( r | j }nd }|�|j |� y y �Nr r* )r r � feed_data)r �fd�datar, s r �pipe_data_receivedz+SubprocessStreamProtocol.pipe_data_received@ s@ � � ��7��[�[�F� �1�W��[�[�F��F������T�"� r c � � |dk( rz| j }|�|j � | j |� |�| j j d � y | j j |� d| j _ y |dk( r | j }n|dk( r | j }nd }|�$|�|j � n|j |� || j v r| j j |� | j � y )Nr Fr r* ) r �close�connection_lostr � set_result� set_exception�_log_tracebackr r �feed_eofr �remove�_maybe_close_transport)r r9 �exc�piper, s r �pipe_connection_lostz-SubprocessStreamProtocol.pipe_connection_lostJ s� � � ��7��:�:�D���� � ��� � ��%��{��"�"�-�-�d�3� � �"�"�0�0��5� 5:��"�"�1�� ��7��[�[�F� �1�W��[�[�F��F����{����!��$�$�S�)� ������N�N�!�!�"�%��#�#�%r c �2 � d| _ | j � y )NT)r rD �r s r �process_exitedz'SubprocessStreamProtocol.process_exitedh s � �#����#�#�%r c � � t | j � dk( r/| j r"| j j � d | _ y y y )Nr )�lenr r r r= rI s r rD z/SubprocessStreamProtocol._maybe_close_transportl s: � ��t�~�~��!�#��(<�(<��O�O�!�!�#�"�D�O� )=�#r c �8 � || j u r| j S y �N)r r )r �streams r �_get_close_waiterz*SubprocessStreamProtocol._get_close_waiterq s � ��T�Z�Z���%�%�%� r ) r"