AlkantarClanX12

Your IP : 3.136.19.124


Current Path : /opt/alt/python37/lib64/python3.7/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/asyncio/__pycache__/subprocess.cpython-37.opt-1.pyc

B

� fV�@s�dZddlZddlmZddlmZddlmZddlmZddlmZej	Z	ej
Z
ejZGd	d
�d
ejej
�ZGdd�d�Zddddejfd
d�Zddddejd�dd�ZdS))�create_subprocess_exec�create_subprocess_shell�N�)�events)�	protocols)�streams)�tasks)�loggercsPeZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
�ZS)�SubprocessStreamProtocolz0Like StreamReaderProtocol, but for a subprocess.cs<t�j|d�||_d|_|_|_d|_d|_g|_dS)N)�loopF)	�super�__init__�_limit�stdin�stdout�stderr�
_transport�_process_exited�	_pipe_fds)�self�limitr)�	__class__��7/opt/alt/python37/lib64/python3.7/asyncio/subprocess.pyr
sz!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�StreamReaderr�_looprZ
set_transportrrr�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_received?sz+SubprocessStreamProtocol.pipe_data_receivedcCs�|dkr,|j}|dk	r|��|�|�dS|dkr<|j}n|dkrL|j}nd}|dk	rt|dkrj|��n
|�|�||jkr�|j�|�|�	�dS)Nrrr!)
r�closeZconnection_lostrrZfeed_eofZ
set_exceptionr�remove�_maybe_close_transport)rr*�exc�piper#rrr�pipe_connection_lostIs$



z-SubprocessStreamProtocol.pipe_connection_lostcCsd|_|��dS)NT)rr/)rrrr�process_exited`sz'SubprocessStreamProtocol.process_exitedcCs(t|j�dkr$|jr$|j��d|_dS)Nr)�lenrrrr-)rrrrr/ds
z/SubprocessStreamProtocol._maybe_close_transport)r�
__module__�__qualname__�__doc__r
r r)r,r2r3r/�
__classcell__rr)rrr
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|_|��|_dS)N)rZ	_protocolr&rrrZget_pid�pid)rr(r"rrrrr
kszProcess.__init__cCsd|jj�d|j�d�S)N�<r�>)rrr:)rrrrr tszProcess.__repr__cCs
|j��S)N)rZget_returncode)rrrr�
returncodewszProcess.returncodec�s|j��IdHS)z?Wait until the process exit and return the process return code.N)rZ_wait)rrrr�wait{szProcess.waitcCs|j�|�dS)N)r�send_signal)r�signalrrrr?szProcess.send_signalcCs|j��dS)N)r�	terminate)rrrrrA�szProcess.terminatecCs|j��dS)N)r�kill)rrrrrB�szProcess.killc
�s�|j��}|j�|�|r,t�d|t|��y|j��IdHWn8tt	fk
rx}z|rht�d||�Wdd}~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	�debugr4Zdrain�BrokenPipeError�ConnectionResetErrorr-)r�inputrEr0rrr�_feed_stdin�s
 zProcess._feed_stdinc�sdS)Nr)rrrr�_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$rrr&rCr	rE�readr-)rr*r(�stream�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)	rIrJrrOrrZgatherr&r>)rrHrrrrrr�communicate�s


zProcess.communicate)N)rr5r6r
r �propertyr=r>r?rArBrIrJrOrPrrrrr9js	r9c
�sP�dkrt�����fdd�}�j||f|||d�|��IdH\}}	t||	��S)Ncst��d�S)N)rr)r
r)rrrr�<lambda>�sz)create_subprocess_shell.<locals>.<lambda>)rrr)r�get_event_loopZsubprocess_shellr9)
�cmdrrrrr�kwds�protocol_factoryr(r"r)rrrr�sr)rrrrrc�sT�dkrt�����fdd�}�j||f|�|||d�|��IdH\}	}
t|	|
��S)Ncst��d�S)N)rr)r
r)rrrrrR�sz(create_subprocess_exec.<locals>.<lambda>)rrr)rrSZsubprocess_execr9)Zprogramrrrrr�argsrUrVr(r"r)rrrr�sr)�__all__�
subprocess�rrrr�logr	�PIPEZSTDOUTZDEVNULLZFlowControlMixinZSubprocessProtocolr
r9Z_DEFAULT_LIMITrrrrrr�<module>s"XV