Your IP : 3.144.18.59


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

U

i�f��@s�dZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ej
Z
ejZejZGd	d
�d
ej
ej�ZGdd�d�Zddddejfd
d�Zddddejd�dd�ZdS))�create_subprocess_exec�create_subprocess_shell�N�)�events)�	protocols)�streams)�tasks)�loggercsTeZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
�ZS)�SubprocessStreamProtocolcsHt�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__��7/opt/alt/python38/lib64/python3.8/asyncio/subprocess.pyrsz!SubprocessStreamProtocol.__init__cCsn|jjg}|jdk	r&|�d|j���|jdk	rB|�d|j���|jdk	r^|�d|j���d�d�|��S)Nzstdin=zstdout=zstderr=z<{}>� )r�__name__r�appendrr�format�join)r�inforrr�__repr__s



z!SubprocessStreamProtocol.__repr__cCs�||_|�d�}|dk	rDtj|j|jd�|_|j�|�|j�	d�|�d�}|dk	r�tj|j|jd�|_
|j
�|�|j�	d�|�d�}|dk	r�tj||d|jd�|_dS)Nr�rr�r)�protocol�readerr)
r�get_pipe_transportr�StreamReaderrrrZ
set_transportrr r�StreamWriterr)r�	transportZstdout_transportZstderr_transportZstdin_transportrrr�connection_made)s,
�
�
�z(SubprocessStreamProtocol.connection_madecCs:|dkr|j}n|dkr |j}nd}|dk	r6|�|�dS)Nrr&)rrZ	feed_data)r�fd�datar(rrr�pipe_data_receivedAsz+SubprocessStreamProtocol.pipe_data_receivedcCs�|dkrN|j}|dk	r|��|�|�|dkr>|j�d�n|j�|�dS|dkr^|j}n|dkrn|j}nd}|dk	r�|dkr�|��n
|�|�||j	kr�|j	�
|�|��dS)Nrrr&)r�closeZconnection_lostrZ
set_resultZ
set_exceptionrrZfeed_eofr�remove�_maybe_close_transport)rr.�exc�piper(rrr�pipe_connection_lostKs*



z-SubprocessStreamProtocol.pipe_connection_lostcCsd|_|��dS)NT)rr3�rrrr�process_exitedfsz'SubprocessStreamProtocol.process_exitedcCs(t|j�dkr$|jr$|j��d|_dS)Nr)�lenrrrr1r7rrrr3js
z/SubprocessStreamProtocol._maybe_close_transportcCs||jkr|jSdS�N)rr)r�streamrrr�_get_close_waiteros
z*SubprocessStreamProtocol._get_close_waiter)r�
__module__�__qualname__rr$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'rrrrruszProcess.__init__cCsd|jj�d|j�d�S)N�<r�>)rrrAr7rrrr$~szProcess.__repr__cCs
|j��Sr:)rZget_returncoder7rrr�
returncode�szProcess.returncodec�s|j��IdHSr:)rZ_waitr7rrr�wait�szProcess.waitcCs|j�|�dSr:)r�send_signal)r�signalrrrrF�szProcess.send_signalcCs|j��dSr:)r�	terminater7rrrrH�szProcess.terminatecCs|j��dSr:)r�killr7rrrrI�szProcess.killc
�s�|j��}|j�|�|r,t�d|t|��z|j��IdHWn8tt	fk
rx}z|rht�d||�W5d}~XYnX|r�t�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�inputrLr4rrr�_feed_stdin�s 
� zProcess._feed_stdinc�sdSr:rr7rrr�_noop�sz
Process._noopc�s�|j�|�}|dkr|j}n|j}|j��rJ|dkr8dnd}t�d||�|��IdH}|j��r�|dkrndnd}t�d||�|�	�|S)Nr&rrrz%r communicate: read %sz%r communicate: close %s)
rr)rrrrJr	rL�readr1)rr.r,r;�name�outputrrr�_read_stream�s

zProcess._read_streamNc�s�|dk	r|�|�}n|��}|jdk	r2|�d�}n|��}|jdk	rP|�d�}n|��}tj||||jd�IdH\}}}|��IdH||fS)Nrr&r)	rPrQrrUrrZgatherrrE)rrOrrrrrr�communicate�s


�zProcess.communicate)N)rr=r>rr$�propertyrDrErFrHrIrPrQrUrVrrrrr@ts	
r@c
�sb�dkrt���ntjdtdd���fdd�}�j||f|||d�|��IdH\}}	t||	��S)N�ZThe loop argument is deprecated since Python 3.8 and scheduled for removal in Python 3.10.r&��
stacklevelcst��d�S�Nr%�r
rr%rr�<lambda>�s�z)create_subprocess_shell.<locals>.<lambda>�rrr)r�get_event_loop�warnings�warn�DeprecationWarningZsubprocess_shellr@)
�cmdrrrrr�kwds�protocol_factoryr,r'rr%rr�s$
����r)rrrrrc�sf�dkrt���ntjdtdd���fdd�}�j||f|�|||d�|��IdH\}	}
t|	|
��S)NrXr&rYcst��d�Sr[r\rr%rrr]�s�z(create_subprocess_exec.<locals>.<lambda>r^)rr_r`rarbZsubprocess_execr@)Zprogramrrrrr�argsrdrer,r'rr%rr�s(
�����r)�__all__�
subprocessr`�rrrr�logr	�PIPEZSTDOUTZDEVNULLZFlowControlMixinZSubprocessProtocolr
r@Z_DEFAULT_LIMITrrrrrr�<module>s.�bV�
�

?>