Your IP : 3.128.94.112


Current Path : /opt/alt/python35/lib64/python3.5/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/asyncio/__pycache__/base_subprocess.cpython-35.opt-2.pyc



���]]#�@s�ddlZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
Gdd	�d	ej�ZGd
d�dej
�ZGdd
�d
eej�ZdS)�N�)�compat)�	protocols)�
transports)�	coroutine)�loggercsEeZdZdd�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	e
jr�dd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zed d!��Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zed*d+��Zd,d-�Zd.d/�Z�S)0�BaseSubprocessTransportNc
s�t�j|
�d|_||_||_d|_d|_d|_g|_t	j
�|_i|_d|_
|tjkr�d|jd<|tjkr�d|jd<|tjkr�d|jd<y5|jd|d|d|d|d	|d
||�Wn|j��YnX|jj|_|j|jd<|jj�r}t|ttf�r]|}n
|d}tjd||j�|jj|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�protocolr
rrr
rr�waiter�extra�kwargsZprogram)�	__class__��4/opt/alt/python35/lib64/python3.5/base_subprocess.pyrs@									


!
	
	
z BaseSubprocessTransport.__init__cCsp|jjg}|jr%|jd�|jdk	rH|jd|j�|jdk	rn|jd|j�n,|jdk	r�|jd�n
|jd�|jjd�}|dk	r�|jd|j�|jjd�}|jjd	�}|dk	r||kr|jd
|j�n@|dk	r?|jd|j�|dk	r_|jd|j�d
dj	|�S)N�closedzpid=%sz
returncode=%s�runningznot startedrzstdin=%srr	zstdout=stderr=%sz	stdout=%sz	stderr=%sz<%s>� )
r/�__name__r�appendrrr�get�pipe�join)r)�inforr
rr0r0r1�__repr__9s,	

z BaseSubprocessTransport.__repr__cKs
t�dS)N)�NotImplementedError)r)r
rrr
rrr.r0r0r1r VszBaseSubprocessTransport._startcCs
||_dS)N)r)r)r+r0r0r1�set_protocolYsz$BaseSubprocessTransport.set_protocolcCs|jS)N)r)r)r0r0r1�get_protocol\sz$BaseSubprocessTransport.get_protocolcCs|jS)N)r)r)r0r0r1�
is_closing_sz"BaseSubprocessTransport.is_closingcCs�|jr
dSd|_x3|jj�D]"}|dkr;q&|jj�q&W|jdk	r�|jdkr�|jj�dkr�|jj	�r�t
jd|�y|jj�Wnt
k
r�YnXdS)NTz$Close running child process: kill %r)rr�valuesr8r!rr�pollrr#r�warning�kill�ProcessLookupError)r)�protor0r0r1r!bs 		
zBaseSubprocessTransport.closecCs+|js'tjd|t�|j�dS)Nzunclosed transport %r)r�warnings�warn�ResourceWarningr!)r)r0r0r1�__del__�s	zBaseSubprocessTransport.__del__cCs|jS)N)r)r)r0r0r1�get_pid�szBaseSubprocessTransport.get_pidcCs|jS)N)r)r)r0r0r1�get_returncode�sz&BaseSubprocessTransport.get_returncodecCs%||jkr|j|jSdSdS)N)rr8)r)�fdr0r0r1�get_pipe_transport�sz*BaseSubprocessTransport.get_pipe_transportcCs|jdkrt��dS)N)rrD)r)r0r0r1�_check_proc�sz#BaseSubprocessTransport._check_proccCs|j�|jj|�dS)N)rNr�send_signal)r)�signalr0r0r1rO�s
z#BaseSubprocessTransport.send_signalcCs|j�|jj�dS)N)rNr�	terminate)r)r0r0r1rQ�s
z!BaseSubprocessTransport.terminatecCs|j�|jj�dS)N)rNrrC)r)r0r0r1rC�s
zBaseSubprocessTransport.killc	#s�y7�j}�j}|jdk	r]|j�fdd�|j�EdH\}}|�jd<|jdk	r�|j�fdd�|j�EdH\}}|�jd<|jdk	r�|j�fdd�|j�EdH\}}|�jd<|j�j	j
��x'�jD]\}}|j||�q
Wd�_WnKtk
r�}z+|dk	rr|j
�rr|j|�WYdd}~Xn'X|dk	r�|j
�r�|jd�dS)Ncs
t�d�S)Nr)�WriteSubprocessPipeProtor0)r)r0r1�<lambda>�sz8BaseSubprocessTransport._connect_pipes.<locals>.<lambda>rcs
t�d�S)Nr)�ReadSubprocessPipeProtor0)r)r0r1rS�srcs
t�d�S)Nr	)rTr0)r)r0r1rS�sr	)rrrZconnect_write_piperr
Zconnect_read_piper�	call_soonr�connection_mader�	Exception�	cancelled�
set_exception�
set_result)	r)r,�procr*�_r8�callback�data�excr0)r)r1r(�s6		



 z&BaseSubprocessTransport._connect_pipescGs?|jdk	r(|jj||f�n|jj||�dS)N)rr6rrU)r)�cbr^r0r0r1�_call�szBaseSubprocessTransport._callcCs'|j|jj||�|j�dS)N)rarZpipe_connection_lost�_try_finish)r)rLr_r0r0r1�_pipe_connection_lost�sz-BaseSubprocessTransport._pipe_connection_lostcCs|j|jj||�dS)N)rarZpipe_data_received)r)rLr^r0r0r1�_pipe_data_received�sz+BaseSubprocessTransport._pipe_data_receivedcCs�|jj�r"tjd||�||_|jjdkrI||j_|j|jj	�|j
�x*|jD]}|j�sp|j
|�qpWd|_dS)Nz%r exited with return code %r)rr#rr:rr�
returncoderarZprocess_exitedrbrrXrZ)r)rer,r0r0r1�_process_exited�s	
	
z'BaseSubprocessTransport._process_exitedccs>|jdk	r|jS|jj�}|jj|�|EdHS)N)rrZ
create_futurerr6)r)r,r0r0r1�_wait�s
zBaseSubprocessTransport._waitcCsU|jdkrdStdd�|jj�D��rQd|_|j|jd�dS)Ncss$|]}|dk	o|jVqdS)N)�disconnected)�.0�pr0r0r1�	<genexpr>�sz6BaseSubprocessTransport._try_finish.<locals>.<genexpr>T)r�allrr@rra�_call_connection_lost)r)r0r0r1rb�s	z#BaseSubprocessTransport._try_finishcCs7z|jj|�Wdd|_d|_d|_XdS)N)r�connection_lostrr)r)r_r0r0r1rm�s
		z-BaseSubprocessTransport._call_connection_lost)r5�
__module__�__qualname__rr;r r=r>r?r!rZPY34rIrJrKrMrNrOrQrCrr(rarcrdrfrgrbrmr0r0)r/r1rs0)	%	rc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rRcCs(||_||_d|_d|_dS)NF)r[rLr8rh)r)r[rLr0r0r1rs			z!WriteSubprocessPipeProto.__init__cCs
||_dS)N)r8)r)Z	transportr0r0r1rV
sz(WriteSubprocessPipeProto.connection_madecCsd|jj|j|jfS)Nz<%s fd=%s pipe=%r>)r/r5rLr8)r)r0r0r1r;sz!WriteSubprocessPipeProto.__repr__cCs,d|_|jj|j|�d|_dS)NT)rhr[rcrL)r)r_r0r0r1rns	z(WriteSubprocessPipeProto.connection_lostcCs|jjj�dS)N)r[r�
pause_writing)r)r0r0r1rqsz&WriteSubprocessPipeProto.pause_writingcCs|jjj�dS)N)r[r�resume_writing)r)r0r0r1rrsz'WriteSubprocessPipeProto.resume_writingN)	r5rorprrVr;rnrqrrr0r0r0r1rRsrRc@seZdZdd�ZdS)rTcCs|jj|j|�dS)N)r[rdrL)r)r^r0r0r1�
data_received#sz%ReadSubprocessPipeProto.data_receivedN)r5rorprsr0r0r0r1rT srT)rrrF�rrrZ
coroutinesr�logrZSubprocessTransportrZBaseProtocolrRZProtocolrTr0r0r0r1�<module>s�

?>