AlkantarClanX12

Your IP : 3.145.108.43


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/subprocess.cpython-310.opt-2.pyc

o

6��f�K�@sn	ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddlm
ZddlZzddl
Z
WneyDdZ
Ynwgd�ZzddlZddlZdZWneyldZddlZddlZddlZYn0wddlmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(e�)gd��Gdd	�d	e*�Z+Gd
d�de+�Z,Gdd
�d
e+�Z-er�Gdd�d�Z.Gdd�de/�Z0ne1edd�Z2e3ed�r�ej4Z5nej6Z5er�dZ7dd�Z8ngZ7dd�Z8dZ9dZ:dZ;dd�Z<dd�Z=dd�d d!�Z>d"d#�Z?dd�d$d%�Z@Gd&d'�d'eA�ZBddddd(�d)d*�ZCd+d,�ZDd-d.�ZEd/d0�ZFd1d2�ZGeG�ZHdZIGd3d4�d4�ZJdS)5�N)�	monotonic)�Popen�PIPE�STDOUT�call�
check_call�getstatusoutput�	getoutput�check_output�run�CalledProcessError�DEVNULL�SubprocessError�TimeoutExpired�CompletedProcessTF)�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_JOB)rrrrrrrr�STARTUPINFOrrrrrrrr r!r"c@seZdZdS)rN)�__name__�
__module__�__qualname__�r'r'�1/opt/alt/python310/lib64/python3.10/subprocess.pyresrc@�:eZdZ	d	dd�Zdd�Zedd��Zejdd��ZdS)
rNcC�||_||_||_||_dS�N)�
returncode�cmd�output�stderr)�selfr,r-r.r/r'r'r(�__init__o�
zCalledProcessError.__init__cCs`|jr(|jdkr(z
d|jt�|j�fWSty'd|j|jfYSwd|j|jfS)NrzCommand '%s' died with %r.z)Command '%s' died with unknown signal %d.z.Command '%s' returned non-zero exit status %d.)r,r-�signalZSignals�
ValueError�r0r'r'r(�__str__us�

���zCalledProcessError.__str__cCs	|jSr+�r.r5r'r'r(�stdout�szCalledProcessError.stdoutcC�
||_dSr+r7�r0�valuer'r'r(r8��
�NN�r$r%r&r1r6�propertyr8�setterr'r'r'r(rhs

rc@r))
rNcCr*r+)r-�timeoutr.r/)r0r-rAr.r/r'r'r(r1�r2zTimeoutExpired.__init__cCsd|j|jfS)Nz'Command '%s' timed out after %s seconds)r-rAr5r'r'r(r6�s
�zTimeoutExpired.__str__cC�|jSr+r7r5r'r'r(r8�szTimeoutExpired.stdoutcCr9r+r7r:r'r'r(r8�r<r=r>r'r'r'r(r�s

rc@s,eZdZddddddd�dd�Zdd�ZdS)r#rN��dwFlags�	hStdInput�
hStdOutput�	hStdError�wShowWindow�lpAttributeListcCs0||_||_||_||_||_|pdgi|_dS)N�handle_listrC)r0rDrErFrGrHrIr'r'r(r1�szSTARTUPINFO.__init__cCs@|j��}d|vrt|d�|d<t|j|j|j|j|j|d�S)NrJrC)	rI�copy�listr#rDrErFrGrH)r0Z	attr_listr'r'r(rK�s
�zSTARTUPINFO.copy)r$r%r&r1rKr'r'r'r(r#�s
�	r#c@s2eZdZdZejfdd�Zdd�Zdd�ZeZ	dS)	�HandleFcCs|jsd|_||�dSdS)NT)�closed)r0�CloseHandler'r'r(�Close�s�zHandle.ClosecCs|js
d|_t|�Std��)NTzalready closed)rN�intr4r5r'r'r(�Detach�sz
Handle.DetachcCsd|jjt|�fS)Nz%s(%d))�	__class__r$rQr5r'r'r(�__repr__�szHandle.__repr__N)
r$r%r&rN�_winapirOrPrRrT�__del__r'r'r'r(rM�srMZPIPE_BUFi�PollSelectorcCsdSr+r'r'r'r'r(�_cleanup��rXc	CsZtdurdStdd�D]}|jtjd�}|dur*zt�|�Wqty)YqwqdS)N��
_deadstate)�_active�_internal_poll�sys�maxsize�remover4)�inst�resr'r'r(rX�s������������cCs,	g}tjj}|dkr|�dd|�|S)Nr�-�O)r^�flags�optimize�append)�argsr;r'r'r(�"_optim_args_from_interpreter_flagssrlcCsP	ddddddd�}t�}|��D]\}}ttj|�}|dkr(|�d	||�qtjjr3|�d
�ntjjr<|�d�tjjrE|�d�tj	dd�}tjj
}ttd
i�}d|v}|dkrd|�d�n|rk|�d�|rr|�d�|D]	}|�d|�qt|r�|�d�dD]}||vr�||}	|	dur�|}
nd||	f}
|�d|
f�q�|S)N�d�B�S�v�b�q)�debug�dont_write_bytecode�no_site�verbose�
bytes_warning�quietrrfz-Iz-Ez-s�	_xoptions�dev�zerror::BytesWarningzdefault::BytesWarning�defaultz-W)�-Xrz)Zfaulthandler�tracemallocZ
importtimeZshowrefcount�utf8Tz%s=%sr})
rl�items�getattrr^rhrj�isolated�ignore_environment�no_user_site�warnoptionsrwr`�extend)Zflag_opt_maprk�flag�optrpZwarnoptsrwZxoptions�dev_moder;�argr'r'r(�_args_from_interpreter_flagssV��




�r��rAcOsT	t|i|���}z|j|d�WWd�S|���1s#wYdS)Nr�)r�wait�kill)rA�	popenargs�kwargs�pr'r'r(rQs��rcOs<	t|i|��}|r|�d�}|dur|d}t||��dS)Nrkr)r�getr)r�r��retcoder-r'r'r(rbs	

rcOsx	d|vr	td��d|vr0|ddur0|�d�s'|�d�s'|�d�s'|�d�r*d}nd	}||d<t|t|d
d�|��jS)Nr8z3stdout argument not allowed, it will be overridden.�input�universal_newlines�text�encoding�errors��T)r8rA�check)r4r�rrr8)rAr�r��emptyr'r'r(r
us"���r
c@s2eZdZ	ddd�Zdd�Zeej�Zdd�Z	dS)	rNcCr*r+)rkr,r8r/)r0rkr,r8r/r'r'r(r1�r2zCompletedProcess.__init__cCshd�|j�d�|j�g}|jdur|�d�|j��|jdur(|�d�|j��d�t|�jd�|��S)Nz	args={!r}zreturncode={!r}zstdout={!r}zstderr={!r}z{}({})z, )	�formatrkr,r8rjr/�typer$�join)r0rkr'r'r(rT�s

�

zCompletedProcess.__repr__cCs"	|jrt|j|j|j|j��dSr+)r,rrkr8r/r5r'r'r(�check_returncode�s��z!CompletedProcess.check_returncoder=)
r$r%r&r1rT�classmethod�types�GenericAlias�__class_getitem__r�r'r'r'r(r�s


	r)r��capture_outputrAr�cOs&	|dur|�d�durtd��t|d<|r0|�d�dus$|�d�dur(td��t|d<t|d<t|i|���L}z|j||d�\}}Wn'tyc}	z|��trZ|��\|	_|	_	�|�
��d}	~	w|���|��}
|r||
r|t|
|j
||d��Wd�n1s�wYt|j
|
||�S)N�stdinz/stdin and input arguments may not both be used.r8r/z@stdout and stderr arguments may not be used with capture_output.r��r.r/)r�r4rr�communicaterr��
_mswindowsr8r/r��pollrrkr)r�r�rAr�r�r�Zprocessr8r/�excr�r'r'r(r�s@�����rcCs�	g}d}ttj|�D]d}g}|r|�d�d|vp d|vp |}|r(|�d�|D]1}|dkr6|�|�q*|dkrM|�dt|�d�g}|�d�q*|rV|�|�g}|�|�q*|rc|�|�|ro|�|�|�d�qd�|�S)	NF� �	�"�\�z\"r�)�map�os�fsdecoderj�lenr�r�)�seq�resultZ	needquoter�Zbs_buf�cr'r'r(�list2cmdlines8





�
r�c
Csp	zt|ddtd�}d}Wnty%}z|j}|j}WYd}~nd}~ww|dd�dkr4|dd�}||fS)NT)�shellr�r/rrc�
)r
rrr.r,)r-�dataZexitcodeZexr'r'r(r\s��rcCs	t|�dS�Nr{)r)r-r'r'r(r	{s	r	c
Cs�	tsttd�s
dStjdvrdSz<t�d�}|jdd�}t|�dkr%t�|d	}t	t
t|d�d
���}tjdkrE|dkrH|d
krKWdSWdSWdSWdSttt
fyZYdSw)N�posix_spawnF)�darwinZsunos5T�CS_GNU_LIBC_VERSIONr{)�maxsplitr�r�.ZlinuxZglibc)r��)r��hasattrr�r^�platform�confstr�splitr�r4�tupler�rQ�AttributeError�OSError)Zver�partsZlibc�versionr'r'r(�_use_posix_spawn�s0

�����r�c
@s�eZdZ	dZ							dLddddddddd�dd	�Zd
d�Zeej�Z	e
dd
��Zejdd
��Zdd�Z
dd�Zdd�Zejejfdd�Zdd�Zdd�ZdMdd�Zdd�Zdd �Z	dNd!d"�ZdOd#d$�Zd%d&�Zer�d'd(�Zd)d*�Zd+d,�Z d-d.�Z!de"j#e"j$e"j%fd/d0�Z&d1d2�Z'd3d4�Z(d5d6�Z)d7d8�Z*d9d:�Z+e+Z,dSd;d(�Zd<d=�Z-d>d.�Z!e.j/e.j0e.j1fd?d@�Z2de.j3e.j4e5j6fdAd0�Z&dBdC�Z7dDd2�Z'dEd6�Z)dFdG�Z8dHd8�Z*dId:�Z+dJdK�Z,dS)PrFrcNTrr')�user�group�extra_groupsr�r�r��umask�pipesizec+Cs�	t�t��|_d|_d|_|durd}t|t�std��|dur$d}t|t�s-td��t	r8|dur7t
d��n|rD|sDt�dt
�d}|
durLt
d��|d	krTt
d
��||_d|_d|_d|_d|_d|_||_||_||_|dur�|dur�t|�t|�kr�td��|�|||�\}}}}}}t	r�|dkr�t�|��d	�}|dkr�t�|��d	�}|dkr�t�|��d	�}|p�|p�|p�||_|jr�|dur�d|_}d
|_d|_|jr�|dkr�d} d}nd} d}!|du�r-t t!d�s�t
d��t|t"��rzd	dl#}"Wnt$�yt
d��w|"�%|�j&}!nt|t��r|}!n	td�'t(|����|!d	k�r-t
d|!����d}#|du�r�t t!d��s>t
d��t|t"��rHt
d��g}#|D];}$t|$t"��rrzd	dl#}"Wnt$�yft
d��w|#�)|"�%|$�j&��qLt|$t��r|#�)|$��qLtd�'t(|$����|#D]}%|%d	k�r�t
d|%�����q�d}&|du�r�t t!d��s�t
d��t|t"��r�zd	dl*}'Wnt$�y�t
d��w|'�+|�j,}&n
t|t��r�|}&ntd��|&d	k�r�t
d|&����zp|dk�rt-�.|d|�|_|j�rt-j/|jd| ||d�|_|dk�rt-�.|d |�|_|j�rt-j/|j||d!�|_|dk�r8t-�.|d |�|_|j�r8t-j/|j||d!�|_|�0||||||
||
||	||||||||!|#|&||�WdSt1d|j|j|jf�D]}(z|(�2�W�qct3�ywY�qcw|j�s�g})|t4k�r�|)�)|�|t4k�r�|)�)|�|t4k�r�|)�)|�t |d"��r�|)�)|j5�|)D]#}*zt	�r�t|*t6��r�|*�7�nt!�2|*�W�q�t3�y�Y�q�w�)#NFrczbufsize must be an integerzpipesize 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.�localeg�?r{�setregidz>The 'group' parameter is not supported on the current platformzHThe group parameter cannot be a string on systems without the grp modulez,Group must be a string or an integer, not {}z!Group ID cannot be negative, got �	setgroupszEThe 'extra_groups' parameter is not supported on the current platformz#Groups must be a list, not a stringzIItems in extra_groups cannot be strings on systems without the grp modulez9Items in extra_groups must be a string or integer, not {}�setreuidz=The 'user' parameter is not supported on the current platformzGThe user parameter cannot be a string on systems without the pwd modulez#User must be a string or an integerz User ID cannot be negative, got �wb)�
write_through�line_bufferingr�r��rb)r�r��_devnull)8rX�	threadingZLock�
_waitpid_lock�_input�_communication_started�
isinstancerQ�	TypeErrorr�r4�warnings�warn�RuntimeWarningrkr�r8r/�pidr,r�r�r��boolr�_get_handles�msvcrtZopen_osfhandlerR�	text_mode�_sigint_wait_secs�_closed_child_pipe_fdsr�r��str�grp�ImportErrorZgetgrnamZgr_gidr�r�rj�pwd�getpwnamZpw_uid�io�open�
TextIOWrapper�_execute_child�filter�closer�rr�rMrP)+r0rk�bufsize�
executabler�r8r/�
preexec_fn�	close_fdsr��cwd�envr��startupinfo�
creationflags�restore_signals�start_new_session�pass_fdsr�r�r�r�r�r�r�r��p2cread�p2cwrite�c2pread�c2pwrite�errread�errwriter��gidr��gidsZextra_groupZ	gid_check�uidr��fZto_close�fdr'r'r(r1�sX


��


�
�

�
�
�
�


�
�
�
�	�







��zPopen.__init__cCs@d|jj�d|j�d|j�d�}t|�dkr|dd�d}|S)N�<z: returncode: z args: �>�P�Lz...>)rSr$r,rkr�)r0Zobj_reprr'r'r(rT�s���zPopen.__repr__cCrBr+)r�r5r'r'r(r��szPopen.universal_newlinescCst|�|_dSr+)r�r�)r0r�r'r'r(r�scCs |�||�}|�dd��dd�S)Nz
r��
)�decode�replace)r0r�r�r�r'r'r(�_translate_newlinesszPopen._translate_newlinescCs|Sr+r'r5r'r'r(�	__enter__
rYzPopen.__enter__cCs�|jr|j��|jr|j��z0|jr|j��W|tkr;|jdkr6z	|j|jd�Wn	ty5Ynwd|_dS|��dS|tkrf|jdkr]z	|j|jd�Wn	ty\Ynwd|_YdS|��w)Nrr�)	r8r�r/r��KeyboardInterruptr��_waitrr�)r0�exc_typer;�	tracebackr'r'r(�__exit__
s8


�
��
�
zPopen.__exit__cCs\|jsdS|jdur|d|jt|d�|j|d�|jdur*tdur,t�|�dSdSdS)Nzsubprocess %s is still running)�sourcerZ)�_child_createdr,r��ResourceWarningr]r\rj)r0Z_maxsizeZ_warnr'r'r(rV)s

��z
Popen.__del__cCs"t|d�st�tjtj�|_|jS)Nr�)r�r�r��devnull�O_RDWRr�r5r'r'r(�_get_devnull8s
zPopen._get_devnullc
Cs�|r-z|j�|�Wn"tyYnty,}z|jtjkr!n�WYd}~nd}~wwz|j��WdSty?YdStyY}z|jtjkrMn�WYd}~dSd}~wwr+)r��write�BrokenPipeErrorr��errnoZEINVALr�)r0r�r�r'r'r(�_stdin_write=s.���	���zPopen._stdin_writecCsT	|jr
|r
td��|durN|jsN|j|j|jg�d�dkrNd}d}|jr+|�|�n|jr9|j��}|j��n
|jrF|j��}|j��|�	�||fS|durXt
�|}nd}z>z|�|||�\}}Wn-ty�|dur{t
|j|�|��}n|j}d|_z|j|d�W�ty�Y�wwWd|_nd|_w|j	|�|�d�}||fS)Nz.Cannot send input after starting communicationr�rr�T)r�r4r�r8r/�countr#�readr�r��_time�_communicater�minr��_remaining_timerr)r0r�rAr8r/�endtime�sigint_timeout�stsr'r'r(r�VsR



������zPopen.communicatecCs
	|��Sr+)r]r5r'r'r(r��sz
Popen.pollcCs	|durdS|t�Sr+)r&)r0r*r'r'r(r)�s
zPopen._remaining_timecCsR	|durdS|st�|kr't|j||rd�|�nd|r#d�|�d��dd��dS)Nr�r�)r&rrkr�)r0r*�orig_timeoutZ
stdout_seqZ
stderr_seq�skip_check_and_raiser'r'r(�_check_timeout�s���zPopen._check_timeoutcCs~	|dur
t�|}z|j|d�WSty>|dur&t|j|�|��}n|j}d|_z|j|d�W�ty=Y�ww)Nr�r)r&rrr(r�r)r)r0rAr*r+r'r'r(r��s(
����z
Popen.waitc	Cst|dd�}t���m}tr,|dkr|�|j�|dkr!|�|j�|dkr+|�|j�n9|dkr?|dkr?||kr?|�tj|�|dkrR|dkrR||krR|�tj|�|dkre|dkre||kre|�tj|�|durp|�tj|�Wd�n1szwYd|_dS)Nr�rcT)	r��
contextlib�	ExitStackr��callbackrPr�r�r�)	r0rrrrrrZ
devnull_fd�stackr'r'r(�_close_pipe_fds�s*
���
zPopen._close_pipe_fdscCsr	|dur|dur|durdSd\}}d\}}d\}}	|dur;t�tj�}|dur:t�dd�\}}
t|�}t�|
�n4|tkrQt�dd�\}}t|�t|�}}n|tkr]t�	|�
��}nt|t�rht�	|�}nt�	|�
��}|�|�}|dur�t�tj�}|dur�t�dd�\}
}t|�}t�|
�n4|tkr�t�dd�\}}t|�t|�}}n|tkr�t�	|�
��}nt|t�r�t�	|�}nt�	|�
��}|�|�}|dur�t�tj�}	|	dur�t�dd�\}
}	t|	�}	t�|
�n?|tk�rt�dd�\}}	t|�t|	�}}	n(|tk�r|}	n |tk�rt�	|�
��}	nt|t��r%t�	|�}	nt�	|�
��}	|�|	�}	||||||	fS)N)rcrcrcrcrcrc�rcrcr)rUZGetStdHandlerZ
CreatePiperMrOrr
r�Z
get_osfhandlerr�rQ�fileno�_make_inheritablerrr)r0r�r8r/rrrrrr�_r'r'r(r��sx
�


�


�



�zPopen._get_handlescCs(	t�t��|t��ddtj�}t|�S)Nrr{)rUZDuplicateHandleZGetCurrentProcessZDUPLICATE_SAME_ACCESSrM)r0�handle�hr'r'r(r74s
�zPopen._make_inheritablecCs	tdd�|D��S)NcSs,h|]}|d@dkst�|�tjkr|�qS)�)rUZGetFileTypeZFILE_TYPE_CHAR)�.0r9r'r'r(�	<setcomp>Ds��z,Popen._filter_handle_list.<locals>.<setcomp>)rL)r0rJr'r'r(�_filter_handle_list=szPopen._filter_handle_listc!Csz	t|t�rn't|t�r|
rtd��t|g�}nt|tj�r*|
r$td��t|g�}nt|�}|dur7t�|�}|dur?t�}n|�	�}d|||fv}|r]|j
tjO_
||_
||_||_|j}t|ojd|voj|d�}|sr|r�|r�|dur{i}|_t|�dg��}|d<|r�|t|�t|�t|�g7}|�|�|dd�<|r�|s�t�dt�d}|
r�|j
tjO_
tj|_|s�tj�d�}|s�tj�dd	�}tj�|d
d�}tj�|�s�t d��tj�|�r�|}n|}d
�!||�}|dur�t�|�}t"�#d||||�z t�$||ddt|�|	|||�	\}}}} W|�%|||
|||�n|�%|||
|||�wd|_&t'|�|_(||_)t�*|�dS)Nz$bytes args is not allowed on Windows�0path-like args is not allowed when shell is truercrJz?startupinfo.lpAttributeList['handle_list'] overriding close_fdsFZComSpecZ
SystemRootr�ZSystem32zcmd.exez:shell not found: neither %ComSpec% nor %SystemRoot% is setz
{} /c "{}"�subprocess.PopenT)+r�r��bytesr�r�r��PathLiker�r#rKrDrUrrErFrGrIr�rLr�rQr>r�r�r�rrrH�environ�pathr��isabs�FileNotFoundErrorr�r^�auditZ
CreateProcessr4rrM�_handler�rO)!r0rkr�r�r�rr�r�r�r�r�rrrrrrZunused_restore_signalsZ
unused_gidZunused_gidsZ
unused_uidZunused_umaskZunused_start_new_sessionZuse_std_handlesZattribute_listZhave_handle_listrJZcomspecZsystem_rootZhpZhtr��tidr'r'r(r�Js�



��

���
���
zPopen._execute_childcCs.	|jdur||jd�|kr||j�|_|jS�Nr)r,rH)r0r[Z_WaitForSingleObjectZ_WAIT_OBJECT_0Z_GetExitCodeProcessr'r'r(r]�s

zPopen._internal_pollcCs`	|dur	tj}nt|d�}|jdur-t�|j|�}|tjkr&t|j|��t�	|j�|_|jS)Ni�)
rUZINFINITErQr,�WaitForSingleObjectrHZWAIT_TIMEOUTrrk�GetExitCodeProcess)r0rAZtimeout_millisr�r'r'r(r�s
�
zPopen._waitcCs|�|���|��dSr+)rjr%r�)r0Zfh�bufferr'r'r(�
_readerthread�szPopen._readerthreadcCsT|jr!t|d�s!g|_tj|j|j|jfd�|_d|j_|j��|j	rBt|d�sBg|_
tj|j|j	|j
fd�|_d|j_|j��|jrJ|�
|�|jdurc|j�|�|��|j��rct|j|��|j	dur||j�|�|��|j��r|t|j|��d}d}|jr�|j}|j��|j	r�|j
}|j	��|r�|dnd}|r�|dnd}||fS)N�_stdout_buff)�targetrkT�_stderr_buffr)r8r�rOr�ZThreadrNZ
stdout_threadZdaemon�startr/rQZ
stderr_threadr�r#r�r)Zis_aliverrkr�)r0r�r*r-r8r/r'r'r(r'�sJ
��

��







zPopen._communicatecCsp	|jdurdS|tjkr|��dS|tjkr"t�|jtj�dS|tjkr1t�|jtj�dSt	d�
|���)NzUnsupported signal: {})r,r3�SIGTERM�	terminateZCTRL_C_EVENTr�r�r�ZCTRL_BREAK_EVENTr4r��r0Zsigr'r'r(�send_signal!s



zPopen.send_signalcCsX	|jdurdSz
t�|jd�WdSty+t�|j�}|tjkr%�||_YdSwr�)r,rUZTerminateProcessrH�PermissionErrorrLZSTILL_ACTIVE)r0Zrcr'r'r(rT/s

�zPopen.terminatec
Cs�	d\}}d\}}d\}}	|durn3|tkr0t��\}}|jdkr/ttd�r/t�|tj|j�n|tkr9|��}nt	|t
�rA|}n|��}|durJn3|tkrht��\}}|jdkrgttd�rgt�|tj|j�n|tkrq|��}nt	|t
�ry|}n|��}|dur�nD|tkr�t��\}}	|jdkr�ttd�r�t�|	tj|j�n&|tkr�|dkr�|}	nt
j��}	n|tkr�|��}	nt	|t
�r�|}	n|��}	||||||	fS)Nr5r�F_SETPIPE_SZrc)rr��piper�r��fcntlrXr
rr�rQr6rr^�
__stdout__)
r0r�r8r/rrrrrrr'r'r(r�Ds`�

�

�

�cCs�	|durtj}i}|r&g}dD]}
tt|
d�}|dur!|�|�q||d<g}|||	fD]}|dkr;|�tj|f�q-|df|df|
dffD]\}}|dkrX|�tj||f�qG|r_||d<tj|||fi|��|_d|_	|�
|||||	|
�dS)	N)�SIGPIPEZSIGXFZ�SIGXFSZZ	setsigdefrcrr{r��file_actionsT)r�rCr�r3rj�POSIX_SPAWN_CLOSE�POSIX_SPAWN_DUP2r�r�rr4)r0rkr�r�r�rrrrrrr�ZsigsetZsignameZsignumr^rZfd2r'r'r(�_posix_spawn�s@
�����zPopen._posix_spawnc-s�	t|ttf�r|g}nt|tj�r|
rtd��|g}nt|�}|
r7ttd�r)dnd}|dg|}�r7�|d<�dur?|d�t�	d�|||�t
r�tj���r�|dur�|s�|s�|dur�|dksd|d	kr�|dksl|d	kr�|dkst|d	kr�|s�|dur�|dur�|dur�|dkr�|�
|�|||||
|||�
dS�}t��\}}g}|d
kr�|�|�t�|�}|d
ks�|D]}t�|�q�z�z||dur�g}|��D]\}}t�|�}d|vr�td��|�|dt�|��q�nd}t����tj���r��f} nt�fd
d�t�|�D��} t|�}!|!�|�t�|| |tttt|!���|||||
||||||||||||�|_d|_Wt�|�nt�|�w|� |||
|||�t!�}"	t�"|d�}#|"|#7}"|#�rbt#|"�dk�rcn�qNWt�|�nt�|�w|"�r�zt�$|jd�\}$}%|$|jk�r�|�%|%�ntj&|_'Wn
t(�y�Ynwz|"�)dd	�\}&}'}(|(�*�}(Wnt�y�d}&d}'d�+t|"��}(Ynwt,t-|&�*d�t.�})t/|)t0��r�|'�r�t|'d�}*|(dk}+|+�r�d}(|},n|},|*dk�r�t�1|*�}(|)|*|(|,��|)|(��dS)Nr?Zgetandroidapilevelz/system/bin/shz/bin/shz-crr@rcr�r;�=z!illegal environment variable namec3s$�|]
}tj�t�|���VqdSr+)r�rDr��fsencode)r<�dir�r�r'r(�	<genexpr>�s
��
�z'Popen._execute_child.<locals>.<genexpr>TiP��:sSubprocessError�0z#Bad exception data from child: {!r}�ascii�Znoexecr�)2r�r�rAr�rBr�rLr�r^rG�_USE_POSIX_SPAWNrD�dirnamerarYrj�dupr�r�rcr4r��
get_exec_path�set�add�_posixsubprocessZ	fork_exec�sortedr�rQr�rr4�	bytearrayr%r��waitpid�_handle_exitstatusr_r,�ChildProcessErrorr�rr�r��builtinsr�
issubclassr��strerror)-r0rkr�r�r�rr�r�r�r�r�rrrrrrr�rrr	r�r�Z
unix_shellZorig_executableZerrpipe_readZ
errpipe_writeZlow_fds_to_closeZlow_fdZenv_list�krpZexecutable_listZfds_to_keepZerrpipe_data�partr�r,Zexception_nameZ	hex_errno�err_msgZchild_exception_typeZ	errno_numZchild_exec_never_calledZerr_filenamer'rer(r��s	��
�����

�
�
�
�
����
���
�


�cCs(	||�r
||�|_dS||�|_dSr+)r,)r0r,�waitstatus_to_exitcodeZ_WIFSTOPPEDZ	_WSTOPSIGr'r'r(ruKszPopen._handle_exitstatusc
Cs�	|jdurm|j�d�sdSzXz#|jdur|jWW|j��S||j|�\}}||jkr1|�|�Wn"tyT}z|durB||_n|j|krJd|_WYd}~nd}~wwW|j��|jSW|j��|jS|j��w|jS)NFr)r,r��acquire�releaser�rur�r")r0r[Z_waitpidZ_WNOHANGZ_ECHILDr�r,�er'r'r(r]Ws6

�

�
���
�
��cCsB	zt�|j|�\}}W||fSty |j}d}Y||fSwrJ)r�rtr�rv)r0Z
wait_flagsr�r,r'r'r(�	_try_waitzs��zPopen._try_waitcCs^	|jdur	|jS|durot�|}d}	|j�d�rRz0|jdur*W|j��|jS|�tj�\}}||jkrE|�	|�W|j��|jSW|j��n|j��w|�
|�}|dkrat|j|��t
|d|d�}t�|�q|jdur�|j�(|jdur�	Wd�|jS|�d�\}}||jkr�|�	|�Wd�n1s�wY|jdust|jS)Ng����Mb@?TFrr�g�������?)r,r&r�r~rr�r��WNOHANGr�rur)rrkr(�time�sleep)r0rAr*Zdelayr�r,Z	remainingr'r'r(r�sP



�


�

�

�	�

��
�
c
Cs$|jr*|js*z|j��Wn	tyYnw|s*z|j��Wn	ty)Ynwd}d}|jsFi|_|jr=g|j|j<|jrFg|j|j<|jrO|j|j}|jrX|j|j}|�|�|j	ret
|j	�}t���}|jrv|rv|�|jt
j�|jr�|jjs�|�|jt
j�|jr�|jjs�|�|jt
j�|���r=|�|�}|dur�|dkr�|j||||dd�td��|�|�}	|�||||�|	D]u\}
}|
j|ju�r||j|jt�}z|jt�|
j|�7_Wnty�|�|
j�|
j��Yq�w|jt|j	�k�r|�|
j�|
j��q�|
j|j|jfv�r8t�|
jd�}
|
�s/|�|
j�|
j��|j|
j�|
�q�|��s�Wd�n	1�sHwY|j |�|�d�|du�r`d�!|�}|du�rjd�!|�}|j"�r�|du�r~|�#||jj$|jj%�}|du�r�|�#||jj$|jj%�}||fS)NrT)r.zN_check_timeout(..., skip_check_and_raise=True) failed to raise TimeoutExpired.i�r�r�)&r�r��flushr!r�Z_fileobj2outputr8r/�_save_inputr��
memoryview�_PopenSelector�register�	selectorsZEVENT_WRITErNZ
EVENT_READZget_mapr)r/�RuntimeError�selectZfileobj�
_input_offset�	_PIPE_BUFr�r r�
unregisterr�r%rjr�r�r�rr�r�)r0r�r*r-r8r/Z
input_viewZselectorrAZready�keyZevents�chunkr�r'r'r(r'�s���




��
��
�
����,




�
�cCsV|jr#|jdur%d|_||_|dur'|jr)|j�|jj|jj�|_dSdSdSdSdSrJ)r�r�r�r��encoder�r�)r0r�r'r'r(r�s
��zPopen._save_inputcCsB	|��|jdurdSz
t�|j|�WdSty YdSwr+)r�r,r�r�r��ProcessLookupErrorrUr'r'r(rV"s
�cC�	|�tj�dSr+)rVr3rSr5r'r'r(rTB�cCr�r+)rVr3�SIGKILLr5r'r'r(r�Gr�z
Popen.kill)rcNNNNNTFNNNNrTFr'r=)Fr+)9r$r%r&rr1rTr�r�r�r�r?r�r@rrrr^r_r�r�rVrr#r�r�r)r/r�r4r�r�r7r>r�rUrKZ
WAIT_OBJECT_0rLr]rrNr'rVrTr�rar�r}�
WIFSTOPPED�WSTOPSIGrurtr�r"ZECHILDr�r�r'r'r'r(r�s�5�
�|
	


D	
�
H	

�2<'&
�
�#
)f r)Krwr"r�r�r�r3r^r�r�r0rr&r�rZr��__all__r�rUr��ModuleNotFoundErrorrqr�r�rrrrrrrrrrrrrrrr r!r"r��	Exceptionrrrr#rQrMr�r�r�rWr�ZSelectSelectorr\rXrrr
rlr�rrr
�objectrrr�rr	r�rkZ
_USE_VFORKrr'r'r'r(�<module>s�"��P

%
	


;4%�FI
2