403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/utils/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/utils/__pycache__/procutil.cpython-39.pyc
a

�+�b�l�@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZddlmZmZmZm
Z
ddlmZe�d�Ze
jr�dd	lmZndd
lmZdd�ZGd
d�dej�ZGdd�de�Z ej!�"e �dd�Z#dd�Z$Gdd�de�Z%ej&�"e%�dd�Z'e
j(�r�ej)du�rDe�Z)nej)j*Z)ej+du�r`e�Z+ne'ej+j*�Z+ej,du�r�e�Z,ne'ej,j*�Z,e
j�r�e�-e+�Z+e�-e,�Z,ee+��re#e+�Z+n\ej)Z)ej+Z+ej,Z,e
j�r�e�-e+�Z+e�-e,�Z,ee+��re
j�re#e+�Z+ne�.e+�/�dd�Z+ej0Z0ej1Z2ej3Z3ej4Z4ej5Z5ej6Z6ej7Z7ej8Z8ej9Z9ej:Z:ej;Z;ej<Z<ej=Z=z
ej>Z>Wne?�y�Yn0z
ej@Z@Wne?�y�Yn0e
jAZBdd�ZCGdd�de�ZDd^d!d"�ZEd#d$�ZFd%d&�ZGd_d'd(�ZHd`d)d*�ZIdad+d,�ZJd-d.�ZKd/d0�ZLeLeKd1�ZMd2d3�ZNdaOd4d5�ZPd6d7�ZQd8d9�ZRd:d;�ZSd<d=�ZTd>d?�ZUd@dA�ZVdbdBdC�ZWe
j�r|dDdE�ZXejYZZndFdE�ZXe
j[ZZdGdH�Z\dcdIdJ�Z]da^dKdL�Z_dMdN�Z`dOdP�ZadQdR�ZbejcdSdT��Zde
j�r�dUZeeeejfBZgdddXdY�Zhn&dedZd[�Zidfd\d]�Zje
j(�reiZhnejZhdS)g�)�absolute_importN���_)�getattr�open)�encoding�error�policy�pycompat)�resourceutil�osutil)�windows)�posixcCs$z
|��WStyYdS0dS)NF)�isatty�AttributeError)�fp�r�>/usr/lib64/python3.9/site-packages/mercurial/utils/procutil.pyr.s
rc@s eZdZdZdd�Zdd�ZdS)�BadFilez3Dummy file object to simulate closed stdio behaviorcCsttjd��dS�NzBad file descriptor��IOError�errno�EBADF��self�brrr�readinto8szBadFile.readintocCsttjd��dSrrrrrr�write;sz
BadFile.writeN)�__name__�
__module__�__qualname__�__doc__rrrrrrr5src@s$eZdZdd�Zdd�Zdd�ZdS)�LineBufferedWrappercCs
||_dS�N��orig�rr'rrr�__init__@szLineBufferedWrapper.__init__cCst|j|�Sr%�rr'�r�attrrrr�__getattr__CszLineBufferedWrapper.__getattr__cCs&|j}|�|�}|�d�r"|��|S)N�
)r'r�endswith�flush)r�sr'�resrrrrFs


zLineBufferedWrapper.writeN�r r!r"r)r-rrrrrr$?sr$cCs,tjrt|tj�s|St|t�r$|St|�Sr%)r�ispy3�
isinstance�io�BufferedIOBaser$��streamrrr�make_line_bufferedSs

r:cCs$t|t�r t|jt�rJ�|jS|Sr%)r5r$r'r8rrr�unwrap_line_buffered_s
r;c@s$eZdZdd�Zdd�Zdd�ZdS)�WriteAllWrappercCs
||_dSr%r&r(rrrr)gszWriteAllWrapper.__init__cCst|j|�Sr%r*r+rrrr-jszWriteAllWrapper.__getattr__cCsF|jj}t|�}t|�}d}||krB|||d��}|r||7}q|S�Nr)r'r�
memoryview�len)rr1Zwrite1�mZtotal_to_writeZ
total_written�crrrrms
zWriteAllWrapper.writeNr3rrrrr<fsr<cCs0tjs
J�t|t�r|St|tj�r(|St|�Sr%)rr4r5r<r6r7r8rrr�_make_write_all~s

rB�wb�cCs"|dkrtd�|Std�|S)zpreturn a message describing a subprocess status
    (codes from kill are negative - not os.system/wait encoding)rsexited with status %dskilled by signal %dr)�coderrr�explainexit�srFc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�_pfilez;File-like wrapper for a stream opened by subprocess.Popen()cCs||_||_dSr%)�_proc�_fp)r�procrrrrr)�sz_pfile.__init__cCs|j��|j��Sr%)rI�closerH�wait�rrrrrK�s
z_pfile.closecCs
t|j�Sr%)�iterrIrMrrr�__iter__�sz_pfile.__iter__cCst|j|�Sr%)rrIr+rrrr-�sz_pfile.__getattr__cCs|Sr%rrMrrr�	__enter__�sz_pfile.__enter__cCs|��dSr%)rK)r�exc_type�	exc_valueZexc_tbrrr�__exit__�sz_pfile.__exit__N)
r r!r"r#r)rKrOr-rPrSrrrrrG�srG�rb���cCs6|dkrt||�S|dkr$t||�St�d|��dS)NrTswbsunsupported mode: %r)�_popenreader�_popenwriterr	ZProgrammingError)�cmd�mode�bufsizerrr�popen�s


r[cCs&tjt|�d|ttjd�}t||j�S)NT)�shellrZ�	close_fds�stdout)�
subprocess�Popen�tonativestr�closefds�PIPErGr^�rXrZ�prrrrV�s�rVcCs&tjt|�d|ttjd�}t||j�S)NT)r\rZr]�stdin)r_r`rarbrcrGrfrdrrrrWs�rWc	Cs0tjt|�ddttjtjt|�d�}|j|jfS)NTrU)r\rZr]rfr^�env)r_r`rarbrc�tonativeenvrfr^)rXrgrerrr�popen2s�	ricCst||�\}}}}|||fSr%)�popen4)rXrgrfr^�stderrrerrr�popen3#srlc
Cs:tjt|�d|ttjtjtjt|�d�}|j|j|j|fS)NT)r\rZr]rfr^rkrg)	r_r`rarbrcrhrfr^rk)rXrgrZrerrrrj(s�
rjcCs.tjt|�dttjtjd�}|�|�\}}|S)z9filter string S through command CMD, returning its outputT)r\r]rfr^)r_r`rarbrcZcommunicate)r1rXreZpoutZperrrrr�
pipefilter6s�rmcCs�d\}}�zztjdd�\}}t�|d�}|�|�|��tjdd�\}}t�|�|�d|�}|�d|�}t|�}tjdkr�|d	@r�d
}|r�t	�
td�|t|�f��t
|d��j}|��Wd
�Wz|r�t�|�Wnty�Yn0z|�rt�|�WSt�yYS0S1�s$0YWz|�rBt�|�Wnt�yXYn0z|�rlt�|�Wnt�y�Yn0nVz|�r�t�|�Wnt�y�Yn0z|�r�t�|�Wnt�y�Yn00d
S)z�filter string S through a pair of temporary files with CMD.
    CMD is used as a template to create the real command to be run,
    with the strings INFILE and OUTFILE replaced by the real names of
    the temporary files generated.)NNs
hg-filter-in-)�prefixrCshg-filter-out-sINFILEsOUTFILE�OpenVMSrDrscommand '%s' failed: %srTN)rZmkstemp�os�fdopenrrK�replace�system�sysplatformr	ZAbortrrFr�read�unlink�OSError)r1rXZinnameZoutname�infdr�outfdrErrr�
tempfilterCsd

���rz)s	tempfile:spipe:cCsFt�t�D]0\}}|�|�r
|||t|�d����Sq
t||�S)zMfilter a string through a command that transforms its input to its
    outputN)r�	iteritems�_filtertable�
startswithr?�lstriprm)r1rX�name�fnrrr�filterns
 r�cCs�tdur�tj�d�}tjd}|r,t|�n�t��r`t	tdd�dkrTttjd�q�tt
j�nNt
js�t
j�t	|dd��d	kr�tt
�|j��nttd
�p�t
j�t
jd��tS)z]return location of the 'hg' executable.

    Defaults to $HG or 'hg' in the search path.
    N�HG�__main__�frozen�
macosx_app�EXECUTABLEPATH�__file__��hgshgr)�
_hgexecutabler�environ�get�sys�modules�_sethgexecutabler�
mainfrozenrr�
sysexecutable�	iswindowsrp�path�basename�fsencoder��findexeZsysargv)r�Zmainmodrrr�hgexecutablezs$

���r�cCs|adS)z#set location of the 'hg' executableN)r�)r�rrrr��sr�cCs<t|dd�}z|o|�|��kWStjy6YdS0dS)N�filenoF)rr�r6�UnsupportedOperation)�fZstdfr�rrr�_testfileno�s
r�cCst|tj�Sr%)r�r��	__stdin__�r�rrr�isstdin�sr�cCst|tj�Sr%)r�r��
__stdout__r�rrr�isstdout�sr�cCs�|��||}}t|t�r`t�|���}t�tjtj�}t�	||���t�
|�t�|d�}t|t�r�t�|���}t�	t
��|���t�|d�}||fS)a�Duplicate streams and redirect original if (uin, uout) are stdio

    If uin is stdin, it's redirected to /dev/null. If uout is stdout, it's
    redirected to stderr so the output is still readable.

    Returns (fin, fout) which point to the original (uin, uout) fds, but
    may be copy of (uin, uout). The returned streams can be considered
    "owned" in that print(), exec(), etc. never reach to them.
    �rbrC)r0r�rfrp�dupr�r�devnull�O_RDONLY�dup2rKrqr^rk)�uin�uout�fin�foutZnewfdZnullfdrrr�protectstdio�s




r�cCsJ|��||f||ffD],\}}||urt�|��|���|��qdS)z@Restore (uin, uout) streams from possibly duplicated (fin, fout)N)r0rpr�r�rK)r�r�r�r�r�Zuifrrr�restorestdio�s
r�csBdd��ttj�}|r4|��fdd�t�|�D��t�|d<|S)z>return environ with optional override, useful for shelling outcSs*|dus|durdS|dur dSt�|�S)z9convert python object into string that is useful to shellNF�0T�1)rZbytestr)�valrrr�py2shell�s
zshellenviron.<locals>.py2shellc3s|]\}}|�|�fVqdSr%r)�.0�k�v�r�rr�	<genexpr>��zshellenviron.<locals>.<genexpr>r�)�dictrr��updaterr{r�)r�rgrr�r�shellenviron�s

r�cCst�|t|��Sr%)�platformZ
shelltocmdexer��rXrgrrr�
shelltonative�s�r�cCs|Sr%rr�rrrr��scCst�t|�S)zHconvert the environment from bytes to strings suitable for Popen(), etc.)r�rapplyra)rgrrrrh�srhc	Cs�zt��WntyYn0t|�}|dus8t|�r^tjt|�dtt	|�t
�t|�d�}nXtjt|�dtt	|�t
�t|�tj
tjd�}t|jjd�D]}|�|�q�|��|j}t
jdkr�|d@r�d}|S)	z�enhanced shell command execution.
    run with environment maybe modified, maybe in different dir.

    if out is specified, it is assumed to be a file-like object that has a
    write() method. stdout and stderr will be redirected to out.NT)r\r]rg�cwd)r\r]rgr�r^rkr�rorDr)r^r0�	Exceptionr�r�r_�callrarbrhrr�r`rcZSTDOUTrN�readlinerrL�
returncodert)rXr�r��outrg�rcrJ�linerrrrs�s:
�
�	rscCsPtjr.dtjvrdSttdd�r(t��SdSntjpJtj�d�pJtj�d�SdS)zAre we running in a GUI?sSSH_CONNECTIONF�isguiNTsDISPLAYsWAYLAND_DISPLAY)	r�isdarwinrr�rr
r�r�r�rrrr�_guis

�
�r�cCstdurt�atSr%)�_is_guir�rrrr�gui2sr�cCs2t��r,ttdd�dkr$tjdgStjgSt�S)z�Return the command used to execute current hg

    This is different from hgexecutable() because on Windows we want
    to avoid things opening new shell windows like batch files, so we
    get either the python call or current executable.
    r�Nr�r�)	rr�rr�rr�rr��	_gethgcmdrrrr�hgcmd9s
r�c
s�t���fdd�}d}ttdd�}|dur6t�||�}zjt|�}|�s�|�vsVt|�sx|�sxW|durtt�tj|�dSt�d�q@|W|dur�t�tj|�Sn|dur�t�tj|�0dS)a_Execute the argument list in a detached process.

    condfn is a callable which is called repeatedly and should return
    True once the child process is known to have started successfully.
    At this point, the child process PID is returned. If the child
    process fails to start or finishes before condfn() evaluates to
    True, return -1.
    cs��t���dSr%)�addrprL)Zsignum�frame�Z
terminatedrr�handler[szrundetached.<locals>.handlerN�SIGCHLDrUg�������?)�setr�signal�
spawndetached�testpidr��time�sleep)�argsZcondfnr�Zprevhandlerr��pidrr�r�rundetachedIs.���r�c#s�t�tj�g�g����fdd�}zTzt�tj|�WntyN�d=Yn0dVW�rnt�tj�d��r�t�n �r�t�tj�d��r�t�0dS)aInhibit SIGINT handling on a region of code.

    Note that if this is called in a non-main thread, it turns into a no-op.

    Args:
      warn: A callable which takes no arguments, and returns True if the
            previous signal handling should be restored.
    cs,��rt�tj�d��d=��d�dS)NrT)r��SIGINT�append)r��ZoldsiginthandlerZ
shouldbail�warnrr�disabledsiginthandler|sz.uninterruptible.<locals>.disabledsiginthandlerrN)r��	getsignalr��
ValueError�KeyboardInterrupt)r�r�rr�r�uninterruptiblens"�r��FTc

Cs�z|d}|dur2t��}|�|�|��|�d�tjt�t|�|t	|�dt
|||d�}	|durj||	j�W|dur�|��n|dur�|��0dS)z1Spawn a command without waiting for it to finish.NrT)r\rgr]Z
creationflagsrfr^rk)
r�unnamedtempfilerr0�seekr_r`r�rarh�_creationflagsrLrK)
�scriptrgr\r^rk�ensurestart�record_wait�stdin_bytesrfrerrr�runbgcommand�s.


�

�r�c

s�tjrt�|r|}n$t|t�r&|g}d�dd�|D��}|durPd|}d}	nd}	d}d}
z�zn|durptj}
n$t��}
|
�	|�|
�
�|
�d�|dur�tj}|dur�tj}tj|d|d|
|||	d	��Wn$t
y�|dur�|d
��Yn0W|du�rP|
du�rPt|
t��rJ�|
��n.|du�rN|
du�rNt|
t��rFJ�|
��0|�sztj�fdd�d
�}d|_|��n�j}|du�r�||�dS)�Spawn a command without waiting for it to finish.


        When `record_wait` is not None, the spawned process will not be fully
        detached and the `record_wait` argument will be called with a the
        `Subprocess.wait` function for the spawned process.  This is mostly
        useful for developers that need to make sure the spawned process
        finished before a certain point. (eg: writing test)� css|]}t|�VqdSr%)�
shellquote)r��xrrrr��r�z"runbgcommandpy3.<locals>.<genexpr>Ns( %s ) &TFr)r\rgr]rfr^rk�start_new_session�cs�jSr%)rLr�rerr�<lambda>r�z!runbgcommandpy3.<locals>.<lambda>��target)rr�r�r5�bytes�joinr_ZDEVNULLr�rr0r�r`r��intrK�	threading�Thread�daemon�startrL)
rXrgr\r^rkr�r�r�r�r�rf�tr�rr�r�runbgcommandpy3�sf


�



�


r�c
stjrt�|dur�t����r�|sN�fdd�}tj|d�}	d|	_|	��dSt�	�d�\}
}t�
|�rtt�|�}nt�|�}|dkr�|dkr�t
j}t|d|t�|�f��dSd}d}
�z*z�|dur�t��|dur�ttjd	�}
n$t��}
|
�|�|
��|
�d�|du�r ttjd
�}|du�r6ttjd
�}tj|||d|
||d�}|du�rb||j�d}WnTt�y�}z$|j
d@}|dk�r�d}WYd}~n d}~0t�y�d}Yn0W|
du�r�|
��|du�rt�|�n(|
du�r�|
��|du�rt�|�0dS)r�Ncst��d�dSr=)rp�waitpidr�r�rr�_do_wait<sz!runbgcommandpy2.<locals>._do_waitr�Trr�serror running %r: %s�r�w)r\rgr]rfr^rk)rr�r�rp�forkr�r�r�r�r��	WIFEXITED�WEXITSTATUS�WTERMSIGr�EINVALrw�strerror�setsidrr�r�rr0r�r_r`rL�EnvironmentErrorr�rK�_exit)rXrgr\r^rkr�r�r�rr�Z_pid�statusr�rfre�exrrr�runbgcommandpy2s�
��



�	





�

r)rTrU)N)N)NrU)N)NNN)FNNTNN)FNNTNN)FNNTNN)kZ
__future__r�
contextlibrr6rpr�r_r�r�r�Zi18nrrrrr�rr	r
ZutilsrZ	importmodr
r�rr�rr�	RawIOBaser�objectr$r7�registerr:r;r<�IOBaserBr4rf�bufferr^rkZ	winstdoutrqr�r�Zgethgcmdr�Zgetuser�getpidZ
hidewindowZreadpipeZ	setbinaryZsetsignalhandlerr�Z
shellsplitr�Zsshargsr�ZsetprocnamerZ
unblocksignalZisposixrbrFrGr[rVrWrirlrjrmrzr|r�r�r�r�r�r�r�r�r�r�r�Zstrfromlocalra�identityrhrsr�r�r�r�r��contextmanagerr�ZDETACHED_PROCESSZCREATE_NEW_PROCESS_GROUPr�r�r�rrrrr�<module>
s

















&�		

&%
!���,�
W�
r

Youez - 2016 - github.com/yon3zu
LinuXploit