Your IP : 18.118.128.17


Current Path : /opt/alt/python39/lib64/python3.9/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/asyncio/__pycache__/base_subprocess.cpython-39.pyc

a

R�f�"�@sxddlZddlZddlZddlmZddlmZddlmZGdd�dej�Z	Gdd	�d	ej
�ZGd
d�deej�Z
dS)�N�)�	protocols)�
transports)�loggercs�eZdZd0�fdd�	Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	e
jfdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Z�ZS)1�BaseSubprocessTransportNc
	s&t��|
�d|_||_||_d|_d|_d|_g|_t	�
�|_i|_d|_
|tjkr`d|jd<|tjkrtd|jd<|tjkr�d|jd<z"|jf||||||d�|��Wn|���Yn0|jj|_|j|jd<|j���rt|ttf�r�|}n|d}t�d||j�|j�|�|	��dS)NFrr�)�args�shell�stdin�stdout�stderr�bufsize�
subprocesszprocess %r created: pid %s)�super�__init__�_closed�	_protocol�_loop�_proc�_pid�_returncode�
_exit_waiters�collections�deque�_pending_calls�_pipes�	_finishedr�PIPE�_start�close�pidZ_extra�	get_debug�
isinstance�bytes�strr�debugZcreate_task�_connect_pipes)
�self�loop�protocolrr	r
rrr
�waiterZextra�kwargsZprogram��	__class__��</opt/alt/python39/lib64/python3.9/asyncio/base_subprocess.pyrsH






��

�z BaseSubprocessTransport.__init__cCs|jjg}|jr|�d�|jdur6|�d|j���|jdurT|�d|j���n |jdurj|�d�n
|�d�|j�d�}|dur�|�d|j���|j�d�}|j�d	�}|dur�||ur�|�d
|j���n6|dur�|�d|j���|du�r|�d|j���d
�	d�
|��S)N�closedzpid=zreturncode=Zrunningznot startedrzstdin=rrzstdout=stderr=zstdout=zstderr=z<{}>� )r-�__name__r�appendrrr�get�pipe�format�join)r'�infor
rrr.r.r/�__repr__7s,






z BaseSubprocessTransport.__repr__cKst�dS�N)�NotImplementedError)r'rr	r
rrr
r+r.r.r/rTszBaseSubprocessTransport._startcCs
||_dSr:�r)r'r)r.r.r/�set_protocolWsz$BaseSubprocessTransport.set_protocolcCs|jSr:r<�r'r.r.r/�get_protocolZsz$BaseSubprocessTransport.get_protocolcCs|jSr:)rr>r.r.r/�
is_closing]sz"BaseSubprocessTransport.is_closingcCs�|jr
dSd|_|j��D]}|dur(q|j��q|jdur�|jdur�|j��dur�|j�	�rlt
�d|�z|j��Wnt
y�Yn0dS)NTz$Close running child process: kill %r)rr�valuesr5rrrZpollrr!rZwarning�kill�ProcessLookupError)r'�protor.r.r/r`s$
��
zBaseSubprocessTransport.closecCs&|js"|d|��t|d�|��dS)Nzunclosed transport )�source)r�ResourceWarningr)r'Z_warnr.r.r/�__del__{szBaseSubprocessTransport.__del__cCs|jSr:)rr>r.r.r/�get_pid�szBaseSubprocessTransport.get_pidcCs|jSr:)rr>r.r.r/�get_returncode�sz&BaseSubprocessTransport.get_returncodecCs||jvr|j|jSdSdSr:)rr5)r'�fdr.r.r/�get_pipe_transport�s
z*BaseSubprocessTransport.get_pipe_transportcCs|jdurt��dSr:)rrCr>r.r.r/�_check_proc�s
z#BaseSubprocessTransport._check_proccCs|��|j�|�dSr:)rLr�send_signal)r'�signalr.r.r/rM�sz#BaseSubprocessTransport.send_signalcCs|��|j��dSr:)rLr�	terminater>r.r.r/rO�sz!BaseSubprocessTransport.terminatecCs|��|j��dSr:)rLrrBr>r.r.r/rB�szBaseSubprocessTransport.killc	
�srz�j}�j}|jdurB|��fdd�|j�IdH\}}|�jd<|jdurv|��fdd�|j�IdH\}}|�jd<|jdur�|��fdd�|j�IdH\}}|�jd<�jdus�J�|�	�j
j���jD]\}}|j	|g|�R�q�d�_Wn\tt
f�y�Ynbt�yN}z*|du�r:|���s:|�|�WYd}~n(d}~00|du�rn|���sn|�d�dS)Ncs
t�d�S)Nr)�WriteSubprocessPipeProtor.r>r.r/�<lambda>��z8BaseSubprocessTransport._connect_pipes.<locals>.<lambda>rcs
t�d�S)Nr��ReadSubprocessPipeProtor.r>r.r/rQ�rRrcs
t�d�S)NrrSr.r>r.r/rQ�rRr)rrr
Zconnect_write_piperrZconnect_read_piperr�	call_soonr�connection_made�
SystemExit�KeyboardInterrupt�
BaseException�	cancelledZ
set_exception�
set_result)	r'r*�procr(�_r5�callback�data�excr.r>r/r&�sB

�


�


�

 z&BaseSubprocessTransport._connect_pipescGs4|jdur|j�||f�n|jj|g|�R�dSr:)rr3rrU)r'�cbr_r.r.r/�_call�s
zBaseSubprocessTransport._callcCs|�|jj||�|��dSr:)rbrZpipe_connection_lost�_try_finish)r'rJr`r.r.r/�_pipe_connection_lost�sz-BaseSubprocessTransport._pipe_connection_lostcCs|�|jj||�dSr:)rbrZpipe_data_received)r'rJr_r.r.r/�_pipe_data_received�sz+BaseSubprocessTransport._pipe_data_receivedcCs�|dusJ|��|jdus$J|j��|j��r<t�d||�||_|jjdurV||j_|�|jj	�|�
�|jD]}|��sr|�
|�qrd|_dS)Nz%r exited with return code %r)rrr!rr8r�
returncoderbrZprocess_exitedrcrrZr[)r'rfr*r.r.r/�_process_exited�s

z'BaseSubprocessTransport._process_exitedc�s0|jdur|jS|j��}|j�|�|IdHS)zdWait until the process exit and return the process return code.

        This method is a coroutine.N)rrZ
create_futurerr3)r'r*r.r.r/�_wait�s


zBaseSubprocessTransport._waitcCsH|jr
J�|jdurdStdd�|j��D��rDd|_|�|jd�dS)Ncss|]}|duo|jVqdSr:)�disconnected)�.0�pr.r.r/�	<genexpr>�s�z6BaseSubprocessTransport._try_finish.<locals>.<genexpr>T)rr�allrrArb�_call_connection_lostr>r.r.r/rc�s

�z#BaseSubprocessTransport._try_finishcCs<z"|j�|�Wd|_d|_d|_nd|_d|_d|_0dSr:)r�connection_lostrr�r'r`r.r.r/rn�s�z-BaseSubprocessTransport._call_connection_lost)NN)r2�
__module__�__qualname__rr9rr=r?r@r�warnings�warnrGrHrIrKrLrMrOrBr&rbrdrergrhrcrn�
__classcell__r.r.r,r/r
s0�+&	rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rPcCs||_||_d|_d|_dS)NF)r\rJr5ri)r'r\rJr.r.r/rsz!WriteSubprocessPipeProto.__init__cCs
||_dSr:)r5)r'Z	transportr.r.r/rVsz(WriteSubprocessPipeProto.connection_madecCs d|jj�d|j�d|j�d�S)N�<z fd=z pipe=�>)r-r2rJr5r>r.r.r/r9
sz!WriteSubprocessPipeProto.__repr__cCs d|_|j�|j|�d|_dS)NT)rir\rdrJrpr.r.r/ro
sz(WriteSubprocessPipeProto.connection_lostcCs|jj��dSr:)r\r�
pause_writingr>r.r.r/rxsz&WriteSubprocessPipeProto.pause_writingcCs|jj��dSr:)r\r�resume_writingr>r.r.r/rysz'WriteSubprocessPipeProto.resume_writingN)	r2rqrrrrVr9rorxryr.r.r.r/rP�srPc@seZdZdd�ZdS)rTcCs|j�|j|�dSr:)r\rerJ)r'r_r.r.r/�
data_receivedsz%ReadSubprocessPipeProto.data_receivedN)r2rqrrrzr.r.r.r/rTsrT)rrrs�rr�logrZSubprocessTransportrZBaseProtocolrP�ProtocolrTr.r.r.r/�<module>sv�

?>