Your IP : 3.141.27.70


Current Path : /opt/alt/python310/lib64/python3.10/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/asyncio/__pycache__/base_subprocess.cpython-310.pyc

o

6��f�"�@sxddlZddlZddlZddlmZddlmZddlmZGdd�dej�Z	Gdd	�d	ej
�ZGd
d�deej�Z
dS)�N�)�	protocols)�
transports)�loggercs�eZdZ	d0�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
	st��|
�d|_||_||_d|_d|_d|_g|_t	�
�|_i|_d|_
|tjkr0d|jd<|tjkr:d|jd<|tjkrDd|jd<z|jd||||||d�|��Wn|���|jj|_|j|jd<|j��r�t|ttf�rx|}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__r�>/opt/alt/python310/lib64/python3.10/asyncio/base_subprocess.pyrsH






�
�

�z BaseSubprocessTransport.__init__cCs|jjg}|jr
|�d�|jdur|�d|j���|jdur*|�d|j���n|jdur5|�d�n|�d�|j�d�}|durM|�d|j���|j�d�}|j�d	�}|durk||urk|�d
|j���n|durx|�d|j���|dur�|�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rrr/�__repr__7s,





z BaseSubprocessTransport.__repr__cKst��N)�NotImplementedError)r(rr	r
rrr
r,rrr/rTszBaseSubprocessTransport._startcC�
||_dSr:�r)r(r*rrr/�set_protocolW�
z$BaseSubprocessTransport.set_protocolcC�|jSr:r=�r(rrr/�get_protocolZ�z$BaseSubprocessTransport.get_protocolcCr@r:)rrArrr/�
is_closing]rCz"BaseSubprocessTransport.is_closingcCs�|jrdSd|_|j��D]}|durq
|j��q
|jdurI|jdurK|j��durM|j�	�r6t
�d|�z|j��WdSt
yHYdSwdSdSdS)NTz$Close running child process: kill %r)rr�valuesr5r rrZpollrr"rZwarning�kill�ProcessLookupError)r(�protorrr/r `s(


��zBaseSubprocessTransport.closecCs*|js|d|��t|d�|��dSdS)Nzunclosed transport )�source)r�ResourceWarningr )r(Z_warnrrr/�__del__{s�zBaseSubprocessTransport.__del__cCr@r:)rrArrr/�get_pid�rCzBaseSubprocessTransport.get_pidcCr@r:)rrArrr/�get_returncode�rCz&BaseSubprocessTransport.get_returncodecCs||jvr|j|jSdSr:)rr5)r(�fdrrr/�get_pipe_transport�s
z*BaseSubprocessTransport.get_pipe_transportcCs|jdurt��dSr:)rrGrArrr/�_check_proc�s
�z#BaseSubprocessTransport._check_proccCs|��|j�|�dSr:)rPr�send_signal)r(�signalrrr/rQ�sz#BaseSubprocessTransport.send_signalcC�|��|j��dSr:)rPr�	terminaterArrr/rT��z!BaseSubprocessTransport.terminatecCrSr:)rPrrFrArrr/rF�rUzBaseSubprocessTransport.killc	
�s��zy�j}�j}|jdur"|��fdd�|j�IdH\}}|�jd<|jdur<|��fdd�|j�IdH\}}|�jd<|jdurV|��fdd�|j�IdH\}}|�jd<�jdus]J�|�	�j
j���jD]
\}}|j	|g|�R�qhd�_Wn7tt
fy��ty�}z"|dur�|��s�|�|�WYd}~dSWYd}~dSWYd}~dSd}~ww|dur�|��s�|�d�dSdSdS)Nc�
t�d�S)Nr)�WriteSubprocessPipeProtorrArr/�<lambda>��
z8BaseSubprocessTransport._connect_pipes.<locals>.<lambda>rcrV)Nr��ReadSubprocessPipeProtorrArr/rX�rYrcrV)NrrZrrArr/rX�rYr)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�excrrAr/r'�sL�

�


�


�

����z&BaseSubprocessTransport._connect_pipescGs6|jdur|j�||f�dS|jj|g|�R�dSr:)rr3rr\)r(�cbrfrrr/�_call�s
zBaseSubprocessTransport._callcCs|�|jj||�|��dSr:)rirZpipe_connection_lost�_try_finish)r(rNrgrrr/�_pipe_connection_lost�sz-BaseSubprocessTransport._pipe_connection_lostcCs|�|jj||�dSr:)rirZpipe_data_received)r(rNrfrrr/�_pipe_data_received�sz+BaseSubprocessTransport._pipe_data_receivedcCs�|dusJ|��|jdusJ|j��|j��rt�d||�||_|jjdur+||j_|�|jj	�|�
�|jD]}|��sD|�
|�q9d|_dS)Nz%r exited with return code %r)rrr"rr8r�
returncoderirZprocess_exitedrjrrarb)r(rmr+rrr/�_process_exited�s


�
z'BaseSubprocessTransport._process_exitedc�s2�|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+rrr/�_wait�s�


zBaseSubprocessTransport._waitcCsL|jrJ�|jdurdStdd�|j��D��r$d|_|�|jd�dSdS)Ncss�|]
}|duo
|jVqdSr:)�disconnected)�.0�prrr/�	<genexpr>�s��z6BaseSubprocessTransport._try_finish.<locals>.<genexpr>T)rr�allrrEri�_call_connection_lostrArrr/rj�s

��z#BaseSubprocessTransport._try_finishcCs:z|j�|�Wd|_d|_d|_dSd|_d|_d|_wr:)r�connection_lostrr�r(rgrrr/ru�s
�z-BaseSubprocessTransport._call_connection_lost)NN)r2�
__module__�__qualname__rr9rr>rBrDr �warnings�warnrKrLrMrOrPrQrTrFr'rirkrlrnrorjru�
__classcell__rrr-r/r
s2�+&	rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rWcCs||_||_d|_d|_dS)NF)rcrNr5rp)r(rcrNrrr/rs
z!WriteSubprocessPipeProto.__init__cCr<r:)r5)r(Z	transportrrr/r]r?z(WriteSubprocessPipeProto.connection_madecCs d|jj�d|j�d|j�d�S)N�<z fd=z pipe=�>)r.r2rNr5rArrr/r9
s z!WriteSubprocessPipeProto.__repr__cCs d|_|j�|j|�d|_dS)NT)rprcrkrNrwrrr/rv
s
z(WriteSubprocessPipeProto.connection_lostcC�|jj��dSr:)rcr�
pause_writingrArrr/r��z&WriteSubprocessPipeProto.pause_writingcCrr:)rcr�resume_writingrArrr/r�r�z'WriteSubprocessPipeProto.resume_writingN)	r2rxryrr]r9rvr�r�rrrr/rW�srWc@seZdZdd�ZdS)r[cCs|j�|j|�dSr:)rcrlrN)r(rfrrr/�
data_receivedsz%ReadSubprocessPipeProto.data_receivedN)r2rxryr�rrrr/r[sr[)rrrz�rr�logrZSubprocessTransportrZBaseProtocolrWZProtocolr[rrrr/�<module>sv�

?>