AlkantarClanX12

Your IP : 3.149.24.145


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

B

YI~d��@s\ddlZejdkZddlZddlZddlZddlZddlZddlZddl	Z	ddlm
ZGdd�de�Z
Gdd�de
�ZGdd	�d	e
�Zer�ddlZddlZddlZGd
d�d�ZnDddlZddlZddlZddlZeedd
�Zeed�r�ejZnejZddddddddddddd	dgZe�r�ddlmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/e�0dddddd d!d"dd#d$d%d&d'd(d)d*d+d,g�Gd-d.�d.e1�Z2e�r�dZ3d/d0�Z4ngZ3d1d0�Z4d2Z5d3Z6d4Z7d5d6�Z8d7d8�Z9dd9�d:d�Z:d;d�Z;dd9�d<d�Z<Gd=d�de=�Z>dd>dd>d?�d@d�Z?dAdB�Z@dCd�ZAdDd�ZBGdEd�de=�ZCdS)F�N�win32)�	monotonicc@seZdZdS)�SubprocessErrorN)�__name__�
__module__�__qualname__�rr�//opt/alt/python37/lib64/python3.7/subprocess.pyr9src@s8eZdZd	dd�Zdd�Zedd��Zejdd��ZdS)
�CalledProcessErrorNcCs||_||_||_||_dS)N)�
returncode�cmd�output�stderr)�selfrrr
rrrr	�__init__CszCalledProcessError.__init__cCsb|jrN|jdkrNyd|jt�|j�fStk
rJd|j|jfSXnd|j|jfSdS)NrzCommand '%s' died with %r.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)rr�signalZSignals�
ValueError)rrrr	�__str__IszCalledProcessError.__str__cCs|jS)N)r
)rrrr	�stdoutUszCalledProcessError.stdoutcCs
||_dS)N)r
)r�valuerrr	rZs)NN)rrrrr�propertyr�setterrrrr	r
<s
r
c@s8eZdZd	dd�Zdd�Zedd��Zejdd��ZdS)
�TimeoutExpiredNcCs||_||_||_||_dS)N)r�timeoutr
r)rrrr
rrrr	rhszTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)rr)rrrr	rnszTimeoutExpired.__str__cCs|jS)N)r
)rrrr	rrszTimeoutExpired.stdoutcCs
||_dS)N)r
)rrrrr	rvs)NN)rrrrrrrrrrrr	ras
rc@s,eZdZddddddd�dd�Zdd�ZdS)�STARTUPINFOrN)�dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindow�lpAttributeListcCs0||_||_||_||_||_|p(dgi|_dS)N�handle_list)rrrrrr )rrrrrrr rrr	r�szSTARTUPINFO.__init__cCs@|j��}d|kr"t|d�|d<t|j|j|j|j|j|d�S)Nr!)rrrrrr )	r �copy�listrrrrrr)rZ	attr_listrrr	�_copy�s
zSTARTUPINFO._copy)rrrrr$rrrr	r�srZPIPE_BUFi�PollSelector�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�DEVNULL�CompletedProcess)�CREATE_NEW_CONSOLE�CREATE_NEW_PROCESS_GROUP�STD_INPUT_HANDLE�STD_OUTPUT_HANDLE�STD_ERROR_HANDLE�SW_HIDE�STARTF_USESTDHANDLES�STARTF_USESHOWWINDOW�ABOVE_NORMAL_PRIORITY_CLASS�BELOW_NORMAL_PRIORITY_CLASS�HIGH_PRIORITY_CLASS�IDLE_PRIORITY_CLASS�NORMAL_PRIORITY_CLASS�REALTIME_PRIORITY_CLASS�CREATE_NO_WINDOW�DETACHED_PROCESS�CREATE_DEFAULT_ERROR_MODE�CREATE_BREAKAWAY_FROM_JOBr1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBc@s6eZdZdZejfdd�Zdd�Zdd�ZeZ	eZ
dS)	�HandleFcCs|jsd|_||�dS)NT)�closed)r�CloseHandlerrr	�Close�szHandle.ClosecCs |jsd|_t|�Std��dS)NTzalready closed)rD�intr)rrrr	�Detach�sz
Handle.DetachcCsd|jjt|�fS)Nz%s(%d))�	__class__rrG)rrrr	�__repr__�szHandle.__repr__N)rrrrD�_winapirErFrHrJ�__del__rrrrr	rC�srCcCsdS)Nrrrrr	�_cleanup�srMc	Cs`tdkrdSxNtdd�D]>}|jtjd�}|dk	ryt�|�Wqtk
rVYqXqWdS)N)�
_deadstate)�_active�_internal_poll�sys�maxsize�remover)�instZresrrr	rM�s���������cCs*g}tjj}|dkr&|�dd|�|S)Nr�-�O)rQ�flags�optimize�append)�argsrrrr	�"_optim_args_from_interpreter_flagss
r^cCsbddddddd�}t�}x:|��D].\}}ttj|�}|dkr"|�d	||�q"Wtjjrh|�d
�n$tjjrz|�d�tjjr�|�d�tj	dd�}tjj
}ttd
i�}d|k}|dkr�|�d�n|r�|�d�|r�|�d�x|D]}|�d|�q�W|�r|�d�xJdD]B}||k�r||}	|	dk�r>|}
nd||	f}
|�d|
f��qW|S)N�d�B�S�v�b�q)�debug�dont_write_bytecode�no_site�verbose�
bytes_warning�quietrrXz-Iz-Ez-s�	_xoptions�dev�zerror::BytesWarningzdefault::BytesWarning�defaultz-W)z-Xrl)Zfaulthandler�tracemallocZ
importtimeZshowalloccountZshowrefcount�utf8Tz%s=%sz-X)
r^�items�getattrrQrZr\�isolated�ignore_environment�no_user_site�warnoptionsrirS�extend)Zflag_opt_mapr]�flag�optrbZwarnoptsriZxoptions�dev_moder�argrrr	�_args_from_interpreter_flagssN








r|)rc	Os>t||��*}y|j|d�S|���YnXWdQRXdS)N)r)r&�wait�kill)r�	popenargs�kwargs�prrr	r)KscOs6t||�}|r2|�d�}|dkr(|d}t||��dS)Nr]r)r)�getr
)rr��retcoderrrr	r*\s



cOsTd|krtd��d|kr<|ddkr<|�dd�r4dnd|d<t|t|dd	�|��jS)
Nrz3stdout argument not allowed, it will be overridden.�input�universal_newlinesF��T)rr�check)rr�r.r'r)rrr�rrr	r-os#c@s&eZdZddd�Zdd�Zdd�ZdS)	r0NcCs||_||_||_||_dS)N)r]rrr)rr]rrrrrr	r�szCompletedProcess.__init__cCshd�|j�d�|j�g}|jdk	r4|�d�|j��|jdk	rP|�d�|j��d�t|�jd�|��S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatr]rrr\r�typer�join)rr]rrr	rJ�s


zCompletedProcess.__repr__cCs |jrt|j|j|j|j��dS)N)rr
r]rr)rrrr	�check_returncode�sz!CompletedProcess.check_returncode)NN)rrrrrJr�rrrr	r0�s
	F)r��capture_outputrr�cOs |dk	r&|�d�dk	rtd��t|d<|r^|�d�dk	sF|�d�dk	rNtd��t|d<t|d<t||���}y|j||d�\}}Wn^tk
r�}	z,|��tr�|��\|	_|	_	n|�
��Wdd}	~	XYn|���YnX|��}
|�r|
�rt|
|j
||d��WdQRXt|j
|
||�S)N�stdinz/stdin and input arguments may not both be used.rrz@stdout and stderr arguments may not be used with capture_output.)r)r
r)r�rr'r&�communicaterr~�
_mswindowsrrr}�pollr
r]r0)r�r�rr�rr�Zprocessrr�excr�rrr	r.�s4cCs�g}d}x�|D]�}g}|r$|�d�d|kp8d|kp8|}|rH|�d�xj|D]b}|dkrf|�|�qN|dkr�|�dt|�d�g}|�d�qN|r�|�|�g}|�|�qNW|r�|�|�|r|�|�|�d�qWd�|�S)	NF� �	�"�\�z\"r�)r\�lenrwr�)�seq�resultZ	needquoter{Zbs_buf�crrr	�list2cmdlines4






r�c
Cslyt|ddtd�}d}Wn.tk
rF}z|j}|j}Wdd}~XYnX|dd�dkrd|dd�}||fS)NT)�shell�textrrrU�
)r-r(r
r
r)r�dataZexitcodeZexrrr	r+MscCst|�dS)Nrm)r+)rrrr	r,ls
c@s�eZdZdZdFdddd�dd	�Zed
d��Zejdd��Zd
d�Zdd�Z	dd�Z
eje
jfdd�Zdd�Zdd�ZdGdd�Zdd�Zdd�ZdHdd �ZdId!d"�Ze�rd#d$�Zd%d&�Zd'd(�Zd)d*�Zdejejejfd+d,�Z d-d.�Z!d/d0�Z"d1d2�Z#d3d4�Z$d5d6�Z%e%Z&n�d7d$�Zd8d*�Ze'j(e'j)e'j*e'j+e'j,e'j-fd9d:�Z.de'j/e'j0e1j2fd;d,�Z d<d=�Z3d>d.�Z!d?d2�Z#d@dA�Z4dBd4�Z$dCd6�Z%dDdE�Z&dS)Jr&FrUNTrr)�encoding�errorsr�cCsZt�t��|_d|_d|_|dkr(d}t|t�s:td��t	rP|dk	r�t
d��n8|rh|sht�dt
�d}|
dk	rxt
d��|dkr�t
d	��||_d|_d|_d|_d|_d|_||_||_|dk	r�|dk	r�t|�t|�kr�td
��|�|||�\}}}}}}t	�rN|dk�rt�|��d�}|dk�r4t�|��d�}|dk�rNt�|��d�}|�pb|�pb|�pb||_d|_d|_y�|dk�r�t� |d|�|_|j�r�tj!|jd|d
k||d�|_|dk�r�t� |d|�|_|j�r�tj!|j||d�|_|dk�rt� |d|�|_|j�rtj!|j||d�|_|�"||||||
||
||	||||||||�W�nxDt#d|j|j|jf�D]*}y|�$�Wnt%k
�r�YnX�qnW|j�sNg}|t&k�r�|�'|�|t&k�r�|�'|�|t&k�r�|�'|�t(|d��r�|�'|j)�xP|D]H}y*t	�r$t|t*��r$|�+�n
t,�$|�Wnt%k
�rFYnX�qW�YnXdS)NFrUzbufsize must be an integerz0preexec_fn is not supported on Windows platformszpass_fds overriding close_fds.Tz2startupinfo is only supported on Windows platformsrz4creationflags is only supported on Windows platformszlCannot disambiguate when both text and universal_newlines are supplied but different. Pass one or the other.g�?�wbrm)�
write_through�line_bufferingr�r��rb)r�r��_devnull)-rM�	threadingZLock�
_waitpid_lock�_input�_communication_started�
isinstancerG�	TypeErrorr�r�warnings�warn�RuntimeWarningr]r�rr�pidrr�r��boolr�_get_handles�msvcrtZopen_osfhandlerH�	text_mode�_sigint_wait_secs�_closed_child_pipe_fds�io�open�
TextIOWrapper�_execute_child�filter�close�OSErrorr'r\�hasattrr�rCrF�os)rr]�bufsize�
executabler�rr�
preexec_fn�	close_fdsr��cwd�envr��startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsr�r�r��p2cread�p2cwrite�c2pread�c2pwrite�errread�errwrite�fZto_close�fdrrr	r�s�

















zPopen.__init__cCs|jS)N)r�)rrrr	r�>szPopen.universal_newlinescCst|�|_dS)N)r�r�)rr�rrr	r�DscCs |�||�}|�dd��dd�S)Nz
r��
)�decode�replace)rr�r�r�rrr	�_translate_newlinesHszPopen._translate_newlinescCs|S)Nr)rrrr	�	__enter__LszPopen.__enter__cCs�|jr|j��|jr |j��z|jr2|j��Wd|tkrz|jdkrpy|j|jd�Wntk
rnYnXd|_dS|��XdS)Nr)r)	rr�rr��KeyboardInterruptr��_waitrr})r�exc_typer�	tracebackrrr	�__exit__Os 


zPopen.__exit__cCsT|js
dS|jdkr(|d|jt|d�|j|d�|jdkrPtdk	rPt�|�dS)Nzsubprocess %s is still running)�source)rN)�_child_createdrr��ResourceWarningrPrOr\)rZ_maxsizeZ_warnrrr	rLks


z
Popen.__del__cCs"t|d�st�tjtj�|_|jS)Nr�)r�r�r��devnull�O_RDWRr�)rrrr	�_get_devnullzs
zPopen._get_devnullc
Cs�|rZy|j�|�WnDtk
r(Yn2tk
rX}z|jtjkrFn�Wdd}~XYnXy|j��WnDtk
r|Yn2tk
r�}z|jtjkr�n�Wdd}~XYnXdS)N)r��write�BrokenPipeErrorr��errnoZEINVALr�)rr�r�rrr	�_stdin_writes"zPopen._stdin_writecCsT|jr|rtd��|dkr�|js�|j|j|jg�d�dkr�d}d}|jrT|�|�n6|jrp|j��}|j��n|jr�|j��}|j��|�	�n�|dk	r�t
�|}nd}z�y|�|||�\}}Wnhtk
�r,|dk	r�t
|j|�|��}n|j}d|_y|j|d�Wntk
�r$YnX�YnXWdd|_X|j	|�|�d�}||fS)Nz.Cannot send input after starting communicationr�r)rT)r�rr�rr�countr��readr�r}�_time�_communicater��minr��_remaining_timer�r)rr�rrr�endtime�sigint_timeout�stsrrr	r��sD




zPopen.communicatecCs|��S)N)rP)rrrr	r��sz
Popen.pollcCs|dkrdS|t�SdS)N)r�)rr�rrr	r��szPopen._remaining_timecCsL|dkrdS|st�|krHt|j||r0d�|�nd|r@d�|�ndd��dS)Nr�)r
r)r�rr]r�)rr��orig_timeoutZ
stdout_seqZ
stderr_seq�skip_check_and_raiserrr	�_check_timeout�szPopen._check_timeoutcCs�|dk	rt�|}y|j|d�Stk
r�|dk	rJt|j|�|��}n|j}d|_y|j|d�Wntk
rzYnX�YnXdS)N)rr)r�r�r�r�r�r�r)rrr�r�rrr	r}�s
z
Popen.waitcCs~|dkr|dkr|dkrdSd\}}d\}}d\}}	|dkrtt�tj�}|dkr�t�dd�\}}
t|�}t�|
�nh|tkr�t�dd�\}}t|�t|�}}n<|tkr�t�	|�
��}n$t|t�r�t�	|�}nt�	|�
��}|�|�}|dk�r*t�tj�}|dk�r�t�dd�\}
}t|�}t�|
�nn|tk�rXt�dd�\}}t|�t|�}}n@|tk�rrt�	|�
��}n&t|t��r�t�	|�}nt�	|�
��}|�|�}|dk�r�t�tj�}	|	dk�rdt�dd�\}
}	t|	�}	t�|
�n~|tk�rt�dd�\}}	t|�t|	�}}	nP|tk�r$|}	n@|tk�r>t�	|�
��}	n&t|t��rVt�	|�}	nt�	|�
��}	|�|	�}	||||||	fS)N)rUrUrUrUrUrU)rUrUr)rKZGetStdHandler3Z
CreatePiperCrEr'r/r�Z
get_osfhandler�r�rG�fileno�_make_inheritabler4r5r()rr�rrr�r�r�r�r�r��_rrr	r�sn












zPopen._get_handlescCs&t�t��|t��ddtj�}t|�S)Nrrm)rKZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSrC)r�handle�hrrr	r�Zs

zPopen._make_inheritablecCstdd�|D��S)NcSs,h|]$}|d@dks$t�|�tjkr|�qS)�)rKZGetFileTypeZFILE_TYPE_CHAR)�.0r�rrr	�	<setcomp>jsz,Popen._filter_handle_list.<locals>.<setcomp>)r#)rr!rrr	�_filter_handle_listcszPopen._filter_handle_listcCsDt|t�st|�}|dkr"t�}n|��}d|||fk}|r^|jtjO_||_||_	||_
|j}t|oxd|kox|d�}|s�|r�|r�|dkr�i}|_t
|�dg��}|d<|r�|t|�t|�t|�g7}|�|�|dd�<|r�|s�t�dt�d}|
�r�|jtjO_tj|_|�sxtj�d�}|�sdtj�dd�}tj�|dd	�}tj�|��sdtd
��tj�|��r||}n|}d�||�}z@t�||ddt|�|	||dk	�r�t�|�nd|�	\}}}}Wd|dk�r�|� �|dk�r�|� �|dk�r|� �t!|d��rt�"|j#�d
|_$Xd
|_%t&|�|_'||_(t�)|�dS)NrUr!z?startupinfo.lpAttributeList['handle_list'] overriding close_fdsFZComSpecZ
SystemRootr�ZSystem32zcmd.exez:shell not found: neither %ComSpec% nor %SystemRoot% is setz
{} /c "{}"r�T)*r��strr�rr$rrKr7rrrr r�r#r�rGr�r�r�r�r8r6rr��environ�pathr��isabs�FileNotFoundErrorr�Z
CreateProcess�fspathrFr�r�r�r�r�rC�_handler�rE)rr]r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Zunused_restore_signalsZunused_start_new_sessionZuse_std_handlesZattribute_listZhave_handle_listr!ZcomspecZsystem_rootZhpZhtr��tidrrr	r�ps|






zPopen._execute_childcCs,|jdkr&||jd�|kr&||j�|_|jS)Nr)rr)rrNZ_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessrrr	rP�s
zPopen._internal_pollcCs^|dkrtj}nt|d�}|jdkrXt�|j|�}|tjkrJt|j|��t�	|j�|_|jS)Ni�)
rKZINFINITErGr�WaitForSingleObjectrZWAIT_TIMEOUTrr]�GetExitCodeProcess)rrZtimeout_millisr�rrr	r��s

zPopen._waitcCs|�|���|��dS)N)r\r�r�)rZfh�bufferrrr	�
_readerthreadszPopen._readerthreadcCs\|jrBt|d�sBg|_tj|j|j|jfd�|_d|j_|j��|j	r�t|d�s�g|_
tj|j|j	|j
fd�|_d|j_|j��|jr�|�
|�|jdk	r�|j�|�|��|j��r�t|j|��|j	dk	r�|j�|�|��|j��r�t|j|��d}d}|j�r|j}|j��|j	�r0|j
}|j	��|dk	�rB|d}|dk	�rT|d}||fS)N�_stdout_buff)�targetr]T�_stderr_buffr)rr�r	r�ZThreadrZ
stdout_threadZdaemon�startrrZ
stderr_threadr�r�r�r�Zis_aliverr]r�)rr�r�r�rrrrr	r�sF










zPopen._communicatecCsl|jdk	rdS|tjkr"|��nF|tjkr>t�|jtj�n*|tjkrZt�|jtj�nt	d�
|���dS)NzUnsupported signal: {})rr�SIGTERM�	terminateZCTRL_C_EVENTr�r~r�ZCTRL_BREAK_EVENTrr�)r�sigrrr	�send_signal;s




zPopen.send_signalcCsX|jdk	rdSyt�|jd�Wn2tk
rRt�|j�}|tjkrH�||_YnXdS)Nrm)rrKZTerminateProcessr�PermissionErrorrZSTILL_ACTIVE)rZrcrrr	rIs

zPopen.terminatec
Cs,d\}}d\}}d\}}	|dkr"n@|tkr8t��\}}n*|tkrJ|��}nt|t�rZ|}n|��}|dkrln@|tkr�t��\}}n*|tkr�|��}nt|t�r�|}n|��}|dkr�nf|tkr�t��\}}	nP|tkr�|dkr�|}	n
t	j
��}	n.|tk�r|��}	nt|t��r|}	n|��}	||||||	fS)N)rUrUrU)r'r��piper/r�r�rGr�r(rQ�
__stdout__)
rr�rrr�r�r�r�r�r�rrr	r�^sJ





c*s�t|ttf�r|g}nt|�}|
rLttd�r0dnd}|dg|}�rL�|d<�dkr\|d��}t��\}}g}x |dkr�|�|�t�	|�}qrWx|D]}t�
|�q�W�z�z�|dk	�rg}xL|��D]:\}}t�|�}d|kr�t
d��|�|dt�|��q�Wnd}t����tj����r,�f}nt�fd	d
�t�|�D��}t|�}|�|�t�|||tttt|���|||||
||||||||�|_d|_Wdt�
|�Xt|dd�}|d
k�r�|d
k�r�||k�r�t�
|�|d
k�r|
d
k�r||k�rt�
|�|d
k�r.|d
k�r.||k�r.t�
|�|dk	�rBt�
|�d|_t�}x0t�|d�} || 7}| �rxt|�dk�rPP�qPWWdt�
|�X|�r�y6t� |jd�\}!}"|!|jk�r�|�!|"�ntj"|_#Wnt$k
�r�YnXy|�%dd�\}#}$}%|%�&�}%Wn,t
k
�r.d}#d}$d�'t|��}%YnXtt(|#�&d�t)�}&t*|&t+��r�|$�r�t|$d�}'|%dk}(|(�rvd}%|})n|})|'dk�r�t�,|'�}%|'t-j.k�r�|%dt/|)�7}%|&|'|%|)��|&|%��dS)NZgetandroidapilevelz/system/bin/shz/bin/shz-crr��=z!illegal environment variable namec3s"|]}tj�t�|���VqdS)N)r�r�r��fsencode)r��dir)r�rr	�	<genexpr>�sz'Popen._execute_child.<locals>.<genexpr>Tr�rUiP��:r�sSubprocessError�0z#Bad exception data from child: {!r}�ascii�Znoexecr�z: )0r�r��bytesr#r�rQr�rr\�dupr�rqrrr��dirname�tuple�
get_exec_path�set�add�_posixsubprocessZ	fork_exec�sorted�maprGr�r�rrr��	bytearrayr�r��waitpid�_handle_exitstatusrRr�ChildProcessError�splitr�r��builtinsr�
issubclassr��strerrorr��ENOENT�repr)*rr]r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�Z
unix_shellZorig_executableZerrpipe_readZ
errpipe_writeZlow_fds_to_closeZlow_fdZenv_list�krbZexecutable_listZfds_to_keepZ
devnull_fdZerrpipe_data�partr�r�Zexception_nameZ	hex_errnoZerr_msgZchild_exception_typeZ	errno_numZchild_exec_never_calledZerr_filenamer)r�r	r��s�	

















cCsL||�r||�|_n2||�r*||�|_n||�r@||�|_ntd��dS)NzUnknown child exit status!)rr)rr�Z_WIFSIGNALEDZ	_WTERMSIGZ
_WIFEXITEDZ_WEXITSTATUSZ_WIFSTOPPEDZ	_WSTOPSIGrrr	r(#szPopen._handle_exitstatusc
Cs�|jdkr�|j�d�sdSz�y8|jdk	r.|jS||j|�\}}||jkrR|�|�WnBtk
r�}z$|dk	rv||_n|j|kr�d|_Wdd}~XYnXWd|j��X|jS)NFr)rr��acquirer�r(r�r��release)rrNZ_waitpidZ_WNOHANGZ_ECHILDr�r��errr	rP5s 	



cCs>yt�|j|�\}}Wntk
r4|j}d}YnX||fS)Nr)r�r'r�r))rZ
wait_flagsr�r�rrr	�	_try_waitXs
zPopen._try_waitc	Cs|jdk	r|jS|dk	r�t�|}d}x�|j�d�rxz6|jdk	rBP|�tj�\}}||jkrh|�|�PWd|j�	�X|�
|�}|dkr�t|j|��t
|d|d�}t�|�q(WnRxP|jdk�r|j�4|jdk	r�P|�d�\}}||jkr�|�|�WdQRXq�W|jS)Ng����Mb@?Frr�g�������?)rr�r�r2r5r��WNOHANGr�r(r3r�rr]r��timeZsleep)rrr�Zdelayr�r�Z	remainingrrr	r�es8







c
Cs,|jrX|jsXy|j��Wntk
r.YnX|sXy|j��Wntk
rVYnXd}d}|js�i|_|jr~g|j|j<|jr�g|j|j<|jr�|j|j}|jr�|j|j}|�|�|j	r�t
|j	�}t����}|jr�|r�|�|jt
j�|j�r|jj�s|�|jt
j�|j�r6|jj�s6|�|jt
j��x^|���r�|�|�}|dk	�r~|dk�r~|j||||dd�td��|�|�}	|�||||�x�|	D]�\}
}|
j|jk�r<||j|jt�}y|jt�|
j|�7_Wn,tk
�r|�|
j�|
j��Yn*X|jt|j	�k�r�|�|
j�|
j��nP|
j|j|jfk�r�t�|
jd�}
|
�sz|�|
j�|
j��|j|
j�|
��q�W�q:WWdQRX|j |�|�d�|dk	�r�d�!|�}|dk	�r�d�!|�}|j"�r$|dk	�r|�#||jj$|jj%�}|dk	�r$|�#||jj$|jj%�}||fS)NrT)r�zN_check_timeout(..., skip_check_and_raise=True) failed to raise TimeoutExpired.i�)rr�)&r�r��flushr�r�Z_fileobj2outputrr�_save_inputr��
memoryview�_PopenSelector�register�	selectorsZEVENT_WRITErDZ
EVENT_READZget_mapr�r��RuntimeError�selectZfileobj�
_input_offset�	_PIPE_BUFr�r�r�Z
unregisterr�r�r\r}r�r�r�r�r�)rr�r�r�rrZ
input_viewZselectorrZready�keyZevents�chunkr�rrr	r��s�






(







cCsF|jrB|jdkrBd|_||_|dk	rB|jrB|j�|jj|jj�|_dS)Nr)r�r�r@r��encoder�r�)rr�rrr	r9�szPopen._save_inputcCs|jdkrt�|j|�dS)N)rr�r~r�)rrrrr	rs
cCs|�tj�dS)N)rrr
)rrrr	rscCs|�tj�dS)N)rr�SIGKILL)rrrr	r~sz
Popen.kill)rUNNNNNTFNNNNrTFr)NN)F)N)5rrrr�rrr�rr�r�r�rQrRr�r�rLr�r�r�r�r�r�r}r�r�r�r�r�rKrZ
WAIT_OBJECT_0rrPr�rr�rrr~r��WIFSIGNALED�WTERMSIG�	WIFEXITED�WEXITSTATUS�
WIFSTOPPED�WSTOPSIGr(r'r6r�ZECHILDr5r9rrrr	r&ysj.
D	

H	
q46"
)f)DrQ�platformr�r�r�r7rr+r�r�rr��	Exceptionrr
rr�r�rKrr#r?r=rrrAr�r%r;ZSelectSelector�__all__r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrwrGrCrOrMr'r(r/r^r|r)r*r-�objectr0r.r�r+r,r&rrrr	�<module>,sx
%


P

	


;/"DI