Your IP : 18.117.72.244


Current Path : /opt/alt/python34/lib64/python3.4/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/asyncio/__pycache__/base_subprocess.cpython-34.pyo

�
j f"�@s�ddlZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddl
mZGd	d
�d
ej�Z
Gdd�dej�ZGd
d�deej�ZdS)�N�)�compat)�futures)�	protocols)�
transports)�	coroutine)�loggercs0eZdZdd�fdd�Zdd�Zdd�Zdd	�Zd
d�Zej	rldd
�Z
ndd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zedd��Zdd�Zd d!�Zd"d#�Zd$d%�Zed&d'��Zd(d)�Zd*d+�Z�S),�BaseSubprocessTransportNc
s�t�j|
�d|_||_||_d|_d|_d|_g|_t	j
�|_i|_d|_
|tjkr�d|jd<n|tjkr�d|jd<n|tjkr�d|jd<ny5|jd|d|d|d|d	|d
||�Wn|j��YnX|jj|_|j|jd<|jj�r�t|ttf�rf|}n
|d}tjd||j�n|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�loopZprotocolrrr
rrr�waiterZextra�kwargsZprogram)�	__class__��</opt/alt/python34/lib64/python3.4/asyncio/base_subprocess.pyrs@									!
	
	z BaseSubprocessTransport.__init__cCs|jjg}|jr(|jd�n|jdk	rN|jd|j�n|jdk	rt|jd|j�n,|jdk	r�|jd�n
|jd�|jjd�}|dk	r�|jd|j�n|jjd�}|jjd	�}|dk	r(||kr(|jd
|j�nF|dk	rK|jd|j�n|dk	rn|jd|j�nd
dj	|�S)N�closedzpid=%sz
returncode=%sZrunningznot startedrzstdin=%srr
zstdout=stderr=%sz	stdout=%sz	stderr=%sz<%s>� )
r.�__name__r�appendrrr�get�pipe�join)r*�infor
rrr/r/r0�__repr__:s,	
z BaseSubprocessTransport.__repr__cKs
t�dS)N)�NotImplementedError)r*rrr
rrrr-r/r/r0r!WszBaseSubprocessTransport._startcCs|jS)N)r)r*r/r/r0�
is_closingZsz"BaseSubprocessTransport.is_closingcCs�|jr
dSd|_x6|jj�D]%}|dkr>q&n|jj�q&W|jdk	r�|jdkr�|jj�dkr�|jj	�r�t
jd|�ny|jj�Wq�t
k
r�Yq�XndS)NTz$Close running child process: kill %r)rr�valuesr6r"rrZpollrr$rZwarning�kill�ProcessLookupError)r*�protor/r/r0r"]s 		
zBaseSubprocessTransport.closecCs.|js*tjd|t�|j�ndS)Nzunclosed transport %r)r�warnings�warn�ResourceWarningr")r*r/r/r0�__del__{s	zBaseSubprocessTransport.__del__cCs|jS)N)r)r*r/r/r0�get_pid�szBaseSubprocessTransport.get_pidcCs|jS)N)r)r*r/r/r0�get_returncode�sz&BaseSubprocessTransport.get_returncodecCs%||jkr|j|jSdSdS)N)rr6)r*�fdr/r/r0�get_pipe_transport�sz*BaseSubprocessTransport.get_pipe_transportcCs|jdkrt��ndS)N)rr>)r*r/r/r0�_check_proc�sz#BaseSubprocessTransport._check_proccCs|j�|jj|�dS)N)rHr�send_signal)r*�signalr/r/r0rI�s
z#BaseSubprocessTransport.send_signalcCs|j�|jj�dS)N)rHr�	terminate)r*r/r/r0rK�s
z!BaseSubprocessTransport.terminatecCs|j�|jj�dS)N)rHrr=)r*r/r/r0r=�s
zBaseSubprocessTransport.killc	#s�y@�j}�j}|jdk	r`|j�fdd�|j�DdH\}}|�jd<n|jdk	r�|j�fdd�|j�DdH\}}|�jd<n|jdk	r�|j�fdd�|j�DdH\}}|�jd<n|j�j	j
��x'�jD]\}}|j||�qWd�_WnNtk
r�}z.|dk	r~|j
�r~|j|�nWYdd}~Xn*X|dk	r�|j
�r�|jd�ndS)Ncs
t�d�S)Nr)�WriteSubprocessPipeProtor/)r*r/r0�<lambda>�sz8BaseSubprocessTransport._connect_pipes.<locals>.<lambda>rcs
t�d�S)Nr)�ReadSubprocessPipeProtor/)r*r/r0rM�srcs
t�d�S)Nr
)rNr/)r*r/r0rM�sr
)rrr
Zconnect_write_piperrZconnect_read_piper�	call_soonr�connection_mader�	Exception�	cancelledZ
set_exception�
set_result)	r*r,�procr+�_r6�callback�data�excr/)r*r0r)�s6		
#z&BaseSubprocessTransport._connect_pipescGs?|jdk	r(|jj||f�n|jj||�dS)N)rr4rrO)r*�cbrWr/r/r0�_call�szBaseSubprocessTransport._callcCs'|j|jj||�|j�dS)N)rZrZpipe_connection_lost�_try_finish)r*rFrXr/r/r0�_pipe_connection_lost�sz-BaseSubprocessTransport._pipe_connection_lostcCs|j|jj||�dS)N)rZrZpipe_data_received)r*rFrWr/r/r0�_pipe_data_received�sz+BaseSubprocessTransport._pipe_data_receivedcCs�|jj�r%tjd||�n||_|j|jj�|j�x-|j	D]"}|j
�sU|j|�qUqUWd|_	dS)Nz%r exited with return code %r)rr$rr8rrZrZprocess_exitedr[rrRrS)r*�
returncoder,r/r/r0�_process_exited�s	
	
z'BaseSubprocessTransport._process_exitedccsD|jdk	r|jStjd|j�}|jj|�|DdHS)zdWait until the process exit and return the process return code.

        This method is a coroutine.Nr+)rrZFuturerrr4)r*r,r/r/r0�_wait�s
zBaseSubprocessTransport._waitcCsX|jdkrdStdd�|jj�D��rTd|_|j|jd�ndS)Ncss$|]}|dk	o|jVqdS)N)�disconnected)�.0�pr/r/r0�	<genexpr>�sz6BaseSubprocessTransport._try_finish.<locals>.<genexpr>T)r�allrr<rrZ�_call_connection_lost)r*r/r/r0r[�s	z#BaseSubprocessTransport._try_finishcCs7z|jj|�Wdd|_d|_d|_XdS)N)r�connection_lostrr)r*rXr/r/r0rf�s
		z-BaseSubprocessTransport._call_connection_lost)r3�
__module__�__qualname__rr9r!r;r"rZPY34rCrDrErGrHrIrKr=rr)rZr\r]r_r`r[rfr/r/)r.r0r	
s,)	%	r	c@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rLcCs(||_||_d|_d|_dS)NF)rTrFr6ra)r*rTrFr/r/r0r�s			z!WriteSubprocessPipeProto.__init__cCs
||_dS)N)r6)r*Z	transportr/r/r0rPsz(WriteSubprocessPipeProto.connection_madecCsd|jj|j|jfS)Nz<%s fd=%s pipe=%r>)r.r3rFr6)r*r/r/r0r9sz!WriteSubprocessPipeProto.__repr__cCs,d|_|jj|j|�d|_dS)NT)rarTr\rF)r*rXr/r/r0rgs	z(WriteSubprocessPipeProto.connection_lostcCs|jjj�dS)N)rTr�
pause_writing)r*r/r/r0rjsz&WriteSubprocessPipeProto.pause_writingcCs|jjj�dS)N)rTr�resume_writing)r*r/r/r0rksz'WriteSubprocessPipeProto.resume_writingN)	r3rhrirrPr9rgrjrkr/r/r/r0rL�srLc@seZdZdd�ZdS)rNcCs|jj|j|�dS)N)rTr]rF)r*rWr/r/r0�
data_receivedsz%ReadSubprocessPipeProto.data_receivedN)r3rhrirlr/r/r/r0rNsrN)rrr@�rrrrZ
coroutinesr�logrZSubprocessTransportr	ZBaseProtocolrLZProtocolrNr/r/r/r0�<module>s�

?>