Your IP : 13.58.214.43


Current Path : /opt/alt/python38/lib64/python3.8/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/asyncio/__pycache__/base_subprocess.cpython-38.pyc

U

i�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|���YnX|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/python38/lib64/python3.8/asyncio/base_subprocess.pyrsL






��

�z BaseSubprocessTransport.__init__cCs|jjg}|jr|�d�|jdk	r6|�d|j���|jdk	rT|�d|j���n |jdk	rj|�d�n
|�d�|j�d�}|dk	r�|�d|j���|j�d�}|j�d	�}|dk	r�||kr�|�d
|j���n6|dk	r�|�d|j���|dk	�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]}|dkr(q|j��q|jdk	r�|jdkr�|j��dkr�|j�	�rlt
�d|�z|j��Wnt
k
r�YnXdS)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||jkr|j|jSdSdSr:)rr5)r'�fdr.r.r/�get_pipe_transport�s
z*BaseSubprocessTransport.get_pipe_transportcCs|jdkrt��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	
�spz�j}�j}|jdk	rB|��fdd�|j�IdH\}}|�jd<|jdk	rv|��fdd�|j�IdH\}}|�jd<|jdk	r�|��fdd�|j�IdH\}}|�jd<�jdk	s�t	�|�
�jj���jD]\}}|j
|f|��q�d�_Wn\t
tfk
�r�Yn`tk
�rL}z"|dk	�r<|���s<|�|�W5d}~XYn X|dk	�rl|���sl|�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�AssertionError�	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_pipescGs2|jdk	r|j�||f�n|jj|f|��dSr:)rr3rrV)r'�cbr`r.r.r/�_call�s
zBaseSubprocessTransport._callcCs|�|jj||�|��dSr:)rcrZpipe_connection_lost�_try_finish)r'rJrar.r.r/�_pipe_connection_lost�sz-BaseSubprocessTransport._pipe_connection_lostcCs|�|jj||�dSr:)rcrZpipe_data_received)r'rJr`r.r.r/�_pipe_data_received�sz+BaseSubprocessTransport._pipe_data_receivedcCs�|dk	st|��|jdks$t|j��|j��r<t�d||�||_|jjdkrV||j_|�|j	j
�|��|jD]}|�
�sr|�|�qrd|_dS)Nz%r exited with return code %r)rUrrr!rr8r�
returncodercrZprocess_exitedrdrr[r\)r'rgr*r.r.r/�_process_exited�s

z'BaseSubprocessTransport._process_exitedc�s0|jdk	r|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
t�|jdkrdStdd�|j��D��rDd|_|�|jd�dS)Ncss|]}|dk	o|jVqdSr:)�disconnected)�.0�pr.r.r/�	<genexpr>�s�z6BaseSubprocessTransport._try_finish.<locals>.<genexpr>T)rrUr�allrrArc�_call_connection_lostr>r.r.r/rd�s

�z#BaseSubprocessTransport._try_finishcCs*z|j�|�W5d|_d|_d|_XdSr:)rrr�connection_lost�r'rar.r.r/ro�s
z-BaseSubprocessTransport._call_connection_lost)NN)r2�
__module__�__qualname__rr9rr=r?r@r�warnings�warnrGrHrIrKrLrMrOrBr&rcrerfrhrirdro�
__classcell__r.r.r,r/r
s2�+&	rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rPcCs||_||_d|_d|_dS)NF)r]rJr5rj)r'r]rJr.r.r/rsz!WriteSubprocessPipeProto.__init__cCs
||_dSr:)r5)r'Z	transportr.r.r/rWsz(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)rjr]rerJrqr.r.r/rp
sz(WriteSubprocessPipeProto.connection_lostcCs|jj��dSr:)r]r�
pause_writingr>r.r.r/rysz&WriteSubprocessPipeProto.pause_writingcCs|jj��dSr:)r]r�resume_writingr>r.r.r/rzsz'WriteSubprocessPipeProto.resume_writingN)	r2rrrsrrWr9rpryrzr.r.r.r/rP�srPc@seZdZdd�ZdS)rTcCs|j�|j|�dSr:)r]rfrJ)r'r`r.r.r/�
data_receivedsz%ReadSubprocessPipeProto.data_receivedN)r2rrrsr{r.r.r.r/rTsrT)rrrt�rr�logrZSubprocessTransportrZBaseProtocolrPZProtocolrTr.r.r.r/�<module>sv�

?>