AlkantarClanX12

Your IP : 18.117.106.23


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.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)�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__��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__�__doc__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�>)rrrBr7rrrr$~szProcess.__repr__cCs
|j��Sr:)rZget_returncoder7rrr�
returncode�szProcess.returncodec�s|j��IdHS)z?Wait until the process exit and return the process return code.N)rZ_waitr7rrr�wait�szProcess.waitcCs|j�|�dSr:)r�send_signal)r�signalrrrrG�szProcess.send_signalcCs|j��dSr:)r�	terminater7rrrrI�szProcess.terminatecCs|j��dSr:)r�killr7rrrrJ�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�inputrMr4rrr�_feed_stdin�s 
� zProcess._feed_stdinc�sdSr:rr7rrr�_noop�sz
Process._noopc�s�|j�|�}|dkr|j}n|dks(t�|j}|j��rV|dkrDdnd}t�d||�|�	�IdH}|j��r�|dkrzdnd}t�d||�|�
�|S)Nr&rrrz%r communicate: read %sz%r communicate: close %s)rr)r�AssertionErrorrrrKr	rM�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)	rQrRrrWrrZgatherrrF)rrPrrrrrr�communicate�s


�zProcess.communicate)N)rr=r>rr$�propertyrErFrGrIrJrQrRrWrXrrrrrAts	
rAc
�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_shellrA)
�cmdrrrrr�kwds�protocol_factoryr,r'rr%rr�s$
����r)rrrrrc�sf�dkrt���ntjdtdd���fdd�}�j||f|�|||d�|��IdH\}	}
t|	|
��S)NrZr&r[cst��d�Sr]r^rr%rrr_�s�z(create_subprocess_exec.<locals>.<lambda>r`)rrarbrcrdZsubprocess_execrA)Zprogramrrrrr�argsrfrgr,r'rr%rr�s(
�����r)�__all__�
subprocessrb�rrrr�logr	�PIPEZSTDOUTZDEVNULLZFlowControlMixinZSubprocessProtocolr
rAZ_DEFAULT_LIMITrrrrrr�<module>s.�bV�
�