ok

Mini Shell

Direktori : /usr/lib64/python3.6/asyncio/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/asyncio/__pycache__/base_subprocess.cpython-36.pyc

3


 \�#�@s�ddlZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
Gdd	�d	ej�ZGd
d�dej
�ZGdd
�d
eej�ZdS)�N�)�compat)�	protocols)�
transports)�	coroutine)�loggercs�eZdZd0�fdd�	Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	e
jrTdd�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�ZS)1�BaseSubprocessTransportNc
s&t�j|
�d|_||_||_d|_d|_d|_g|_t	j
�|_i|_d|_
|tjkr`d|jd<|tjkrtd|jd<|tjkr�d|jd<y"|jf||||||d�|��Wn|j��YnX|jj|_|j|jd<|jj��rt|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�waiterZextra�kwargsZprogram)�	__class__��//usr/lib64/python3.6/asyncio/base_subprocess.pyrs@








z BaseSubprocessTransport.__init__cCs|jjg}|jr|jd�|jdk	r4|jd|j�|jdk	rP|jd|j�n |jdk	rf|jd�n
|jd�|jjd�}|dk	r�|jd|j�|jjd�}|jjd	�}|dk	r�||kr�|jd
|j�n0|dk	r�|jd|j�|dk	r�|jd|j�d
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r
rr/r/r0�__repr__9s,





z BaseSubprocessTransport.__repr__cKst�dS)N)�NotImplementedError)r)r
rrr
rrr-r/r/r0r VszBaseSubprocessTransport._startcCs
||_dS)N)r)r)r+r/r/r0�set_protocolYsz$BaseSubprocessTransport.set_protocolcCs|jS)N)r)r)r/r/r0�get_protocol\sz$BaseSubprocessTransport.get_protocolcCs|jS)N)r)r)r/r/r0�
is_closing_sz"BaseSubprocessTransport.is_closingcCs�|jr
dSd|_x&|jj�D]}|dkr*q|jj�qW|jdk	r�|jdkr�|jj�dkr�|jj	�rpt
jd|�y|jj�Wnt
k
r�YnXdS)NTz$Close running child process: kill %r)rr�valuesr6r!rrZpollrr#rZwarning�kill�ProcessLookupError)r)�protor/r/r0r!bs 


zBaseSubprocessTransport.closecCs&|js"tjd|t|d�|j�dS)Nzunclosed transport %r)�source)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�s
z*BaseSubprocessTransport.get_pipe_transportcCs|jdkrt��dS)N)rr@)r)r/r/r0�_check_proc�s
z#BaseSubprocessTransport._check_proccCs|j�|jj|�dS)N)rKr�send_signal)r)�signalr/r/r0rL�sz#BaseSubprocessTransport.send_signalcCs|j�|jj�dS)N)rKr�	terminate)r)r/r/r0rN�sz!BaseSubprocessTransport.terminatecCs|j�|jj�dS)N)rKrr?)r)r/r/r0r?�szBaseSubprocessTransport.killc	#s^y�j}�j}|jdk	rB|j�fdd�|j�EdH\}}|�jd<|jdk	rv|j�fdd�|j�EdH\}}|�jd<|jdk	r�|j�fdd�|j�EdH\}}|�jd<�jdk	s�t	�|j
�jj��x"�jD]\}}|j
|f|��q�Wd�_WnDt
k
�r8}z&|dk	�r(|j��r(|j|�WYdd}~Xn"X|dk	�rZ|j��rZ|jd�dS)Ncs
t�d�S)Nr)�WriteSubprocessPipeProtor/)r)r/r0�<lambda>�sz8BaseSubprocessTransport._connect_pipes.<locals>.<lambda>rcs
t�d�S)Nr)�ReadSubprocessPipeProtor/)r)r/r0rP�srcs
t�d�S)Nr	)rQr/)r)r/r0rP�sr	)rrrZconnect_write_piperr
Zconnect_read_piperr�AssertionError�	call_soonr�connection_made�	Exception�	cancelledZ
set_exception�
set_result)	r)r,�procr*�_r6�callback�data�excr/)r)r0r(�s8









z&BaseSubprocessTransport._connect_pipescGs2|jdk	r|jj||f�n|jj|f|��dS)N)rr4rrS)r)�cbr[r/r/r0�_call�s
zBaseSubprocessTransport._callcCs|j|jj||�|j�dS)N)r^rZpipe_connection_lost�_try_finish)r)rIr\r/r/r0�_pipe_connection_lost�sz-BaseSubprocessTransport._pipe_connection_lostcCs|j|jj||�dS)N)r^rZpipe_data_received)r)rIr[r/r/r0�_pipe_data_received�sz+BaseSubprocessTransport._pipe_data_receivedcCs�|dk	st|��|jdks$t|j��|jj�r<tjd||�||_|jjdkrV||j_|j|j	j
�|j�x |jD]}|j
�st|j|�qtWd|_dS)Nz%r exited with return code %r)rRrrr#rr8r�
returncoder^rZprocess_exitedr_rrVrW)r)rbr,r/r/r0�_process_exited�s
z'BaseSubprocessTransport._process_exitedccs0|jdk	r|jS|jj�}|jj|�|EdHS)zdWait until the process exit and return the process return code.

        This method is a coroutine.N)rrZ
create_futurerr4)r)r,r/r/r0�_wait�s


zBaseSubprocessTransport._waitcCsJ|jst�|jdkrdStdd�|jj�D��rFd|_|j|jd�dS)Ncss|]}|dk	o|jVqdS)N)�disconnected)�.0�pr/r/r0�	<genexpr>�sz6BaseSubprocessTransport._try_finish.<locals>.<genexpr>T)rrRr�allrr>r^�_call_connection_lost)r)r/r/r0r_�s
z#BaseSubprocessTransport._try_finishcCs*z|jj|�Wdd|_d|_d|_XdS)N)r�connection_lostrr)r)r\r/r/r0rj�s
z-BaseSubprocessTransport._call_connection_lost)NN)r3�
__module__�__qualname__rr9r r;r<r=r!rZPY34rFrGrHrJrKrLrNr?rr(r^r`rarcrdr_rj�
__classcell__r/r/)r.r0rs0)%	rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)rOcCs||_||_d|_d|_dS)NF)rXrIr6re)r)rXrIr/r/r0rsz!WriteSubprocessPipeProto.__init__cCs
||_dS)N)r6)r)Z	transportr/r/r0rTsz(WriteSubprocessPipeProto.connection_madecCsd|jj|j|jfS)Nz<%s fd=%s pipe=%r>)r.r3rIr6)r)r/r/r0r9sz!WriteSubprocessPipeProto.__repr__cCs d|_|jj|j|�d|_dS)NT)rerXr`rI)r)r\r/r/r0rksz(WriteSubprocessPipeProto.connection_lostcCs|jjj�dS)N)rXr�
pause_writing)r)r/r/r0rosz&WriteSubprocessPipeProto.pause_writingcCs|jjj�dS)N)rXr�resume_writing)r)r/r/r0rpsz'WriteSubprocessPipeProto.resume_writingN)	r3rlrmrrTr9rkrorpr/r/r/r0rOsrOc@seZdZdd�ZdS)rQcCs|jj|j|�dS)N)rXrarI)r)r[r/r/r0�
data_received$sz%ReadSubprocessPipeProto.data_receivedN)r3rlrmrqr/r/r/r0rQ!srQ)rrrC�rrrZ
coroutinesr�logrZSubprocessTransportrZBaseProtocolrOZProtocolrQr/r/r/r0�<module>s{

Zerion Mini Shell 1.0