Your IP : 3.145.89.181


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

o

6��f��@s�dZddlZddlmZddlmZddlmZddlmZddlmZej	Z	ej
Z
ejZGd	d
�d
ejej
�ZGdd�d�Zdddejfd
d�Zdddejd�dd�ZdS))�create_subprocess_exec�create_subprocess_shell�N�)�events)�	protocols)�streams)�tasks)�loggercsXeZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Z�ZS)�SubprocessStreamProtocolz0Like StreamReaderProtocol, but for a subprocess.csHt�j|d�||_d|_|_|_d|_d|_g|_|j	�
�|_dS)N)�loopF)�super�__init__�_limit�stdin�stdout�stderr�
_transport�_process_exited�	_pipe_fds�_loopZ
create_future�
_stdin_closed)�self�limitr��	__class__��9/opt/alt/python310/lib64/python3.10/asyncio/subprocess.pyr
sz!SubprocessStreamProtocol.__init__cCsn|jjg}|jdur|�d|j���|jdur!|�d|j���|jdur/|�d|j���d�d�|��S)Nzstdin=zstdout=zstderr=z<{}>� )r�__name__r�appendrr�format�join)r�inforrr�__repr__s



z!SubprocessStreamProtocol.__repr__cCs�||_|�d�}|dur"tj|j|jd�|_|j�|�|j�	d�|�d�}|durAtj|j|jd�|_
|j
�|�|j�	d�|�d�}|durWtj||d|jd�|_dSdS)Nr�rr�r)�protocol�readerr)
r�get_pipe_transportr�StreamReaderrrrZ
set_transportrrr�StreamWriterr)r�	transportZstdout_transportZstderr_transportZstdin_transportrrr�connection_made(s.
�
�
��z(SubprocessStreamProtocol.connection_madecCs>|dkr|j}n
|dkr|j}nd}|dur|�|�dSdS�Nrr%)rrZ	feed_data)r�fd�datar'rrr�pipe_data_received@s�z+SubprocessStreamProtocol.pipe_data_receivedcCs�|dkr(|j}|dur|��|�|�|dur |j�d�dS|j�|�dS|dkr0|j}n
|dkr8|j}nd}|durL|durG|��n|�|�||j	vrW|j	�
|�|��dS)Nrrr%)r�closeZconnection_lostrZ
set_resultZ
set_exceptionrrZfeed_eofr�remove�_maybe_close_transport)rr.�exc�piper'rrr�pipe_connection_lostJs,
�


z-SubprocessStreamProtocol.pipe_connection_lostcCsd|_|��dS)NT)rr3�rrrr�process_exitedesz'SubprocessStreamProtocol.process_exitedcCs0t|j�dkr|jr|j��d|_dSdSdS)Nr)�lenrrrr1r7rrrr3is

�z/SubprocessStreamProtocol._maybe_close_transportcCs||jur|jSdS�N)rr)r�streamrrr�_get_close_waiterns
�z*SubprocessStreamProtocol._get_close_waiter)
r�
__module__�__qualname__�__doc__r
r#r,r0r6r8r3r<�
__classcell__rrrrr
s	

r
c@sjeZdZdd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
ddd�ZdS)�ProcesscCs8||_||_||_|j|_|j|_|j|_|��|_dSr:)rZ	_protocolrrrrZget_pid�pid)rr+r&rrrrr
tszProcess.__init__cCsd|jj�d|j�d�S)N�<r�>)rrrBr7rrrr#}szProcess.__repr__cCs
|j��Sr:)rZget_returncoder7rrr�
returncode�s
zProcess.returncodec�s�|j��IdHS)z?Wait until the process exit and return the process return code.N)rZ_waitr7rrr�wait�s�zProcess.waitcCs|j�|�dSr:)r�send_signal)r�signalrrrrG�szProcess.send_signalcC�|j��dSr:)r�	terminater7rrrrJ��zProcess.terminatecCrIr:)r�killr7rrrrL�rKzProcess.killc
�s��|j��}|j�|�|rt�d|t|��z
|j��IdHWntt	fy>}z|r4t�d||�WYd}~nd}~ww|rGt�d|�|j�
�dS)Nz%%r communicate: feed stdin (%s bytes)z%r communicate: stdin got %rz%r communicate: close stdin)r�	get_debugr�writer	�debugr9Zdrain�BrokenPipeError�ConnectionResetErrorr1)r�inputrOr4rrr�_feed_stdin�s"�

���zProcess._feed_stdinc�s�dSr:rr7rrr�_noop�s�z
Process._noopc�s��|j�|�}|dkr|j}n|j}|j��r&|dkrdnd}t�d||�|��IdH}|j��rA|dkr8dnd}t�d||�|�	�|S)Nr%rrrz%r communicate: read %sz%r communicate: close %s)
rr(rrrrMr	rO�readr1)rr.r+r;�name�outputrrr�_read_stream�s�

zProcess._read_streamNc�s��|dur|�|�}n|��}|jdur|�d�}n|��}|jdur)|�d�}n|��}t�|||�IdH\}}}|��IdH||fSr-)rSrTrrXrrZgatherrF)rrRrrrrrr�communicate�s�

zProcess.communicater:)rr=r>r
r#�propertyrErFrGrJrLrSrTrXrYrrrrrAss	
rAc	�sJ�t�����fdd�}�j||f|||d�|��IdH\}}t||��S)Nc�t��d�S�Nr$�r
rr$rr�<lambda>���z)create_subprocess_shell.<locals>.<lambda>�rrr)r�get_running_loopZsubprocess_shellrA)	�cmdrrrr�kwds�protocol_factoryr+r&rr$rr�s����r)rrrrc
�sP�t�����fdd�}�j||g|�R|||d�|��IdH\}}	t||	��S)Ncr[r\r]rr$rrr^�r_z(create_subprocess_exec.<locals>.<lambda>r`)rraZsubprocess_execrA)
Zprogramrrrr�argsrcrdr+r&rr$rr�s�����r)�__all__�
subprocess�rrrr�logr	�PIPEZSTDOUTZDEVNULLZFlowControlMixinZSubprocessProtocolr
rAZ_DEFAULT_LIMITrrrrrr�<module>s(�bU
��

?>