HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //lib64/python2.7/site-packages/mercurial/utils/procutil.pyc
�
1�3\c@@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZmZejd�ZejZejZejZd�Zee�r&ejrejej�dd�Zq&ejej�dd	�ZnejrQdd
lmZeje�ZnddlmZejZejZ ej!Z!ej"Z"ej#Z#ej$Z$ej%Z%ej&Z&ej'Z'ej(Z(ej)Z)ej*Z*ej+Z+ej,Z,y
ej-Z-Wne.k
r�nXy
ej/Z/Wne.k
r nXej0Z1d�Z2d
e3fd��YZ4ddd�Z5d�Z6d�Z7dd�Z9dd�Z:ddd�Z;d�Z<d�Z=ie=d6e<d6Z>d�Z?d�Z@daAd�ZBd�ZCd�ZDd �ZEd!�ZFd"�ZGd#�ZHejId$��ZJdd%�ZKejrJd&�ZLe
jMZNnd'�ZLejOZNd(�ZPdddd)�ZQd*�ZRd+�ZSd,�ZTejId-��ZUdS(.i(tabsolute_importNi(t_(tencodingterrortpolicytpycompattosutilcC@s'y|j�SWntk
r"tSXdS(N(tisattytAttributeErrortFalse(tfp((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyR$s
twbi(twindows(tposixcC@s)|dkrtd�|Std�|S(spreturn a message describing a subprocess status
    (codes from kill are negative - not os.system/wait encoding)isexited with status %dskilled by signal %d(R(tcode((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytexplainexitTst_pfilecB@sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s;File-like wrapper for a stream opened by subprocess.Popen()cC@s||_||_dS(N(t_proct_fp(tselftprocR
((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt__init__^s	cC@s|jj�|jj�S(N(RtcloseRtwait(R((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyRbs
cC@s
t|j�S(N(titerR(R((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt__iter__gscC@st|j|�S(N(tgetattrR(Rtattr((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt__getattr__jscC@s|S(N((R((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt	__enter__mscC@s|j�dS(N(R(Rtexc_typet	exc_valuetexc_tb((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt__exit__ps(	t__name__t
__module__t__doc__RRRRRR!(((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyR[s					trbi����cC@sI|dkrt||�S|dkr2t||�Stjd|��dS(NR%Rsunsupported mode: %r(t_popenreadert_popenwriterRtProgrammingError(tcmdtmodetbufsize((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytpopenss


c
C@sFtjtt|��dtd|dtdtj�}t||j�S(NtshellR+t	close_fdststdout(	t
subprocesstPopenttonativestrtquotecommandtTruetclosefdstPIPERR/(R)R+tp((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyR&zs
c
C@sFtjtt|��dtd|dtdtj�}t||j�S(NR-R+R.tstdin(	R0R1R2R3R4R5R6RR8(R)R+R7((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyR'�s
cC@sUtjt|�dtdddtdtjdtjdt|��}|j|jfS(NR-R+i����R.R8R/tenv(	R0R1R2R4R5R6ttonativeenvR8R/(R)R9R7((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytpopen2�scC@s(t||�\}}}}|||fS(N(tpopen4(R)R9R8R/tstderrR7((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytpopen3�scC@sgtjt|�dtd|dtdtjdtjdtjdt|��}|j|j|j	|fS(NR-R+R.R8R/R=R9(
R0R1R2R4R5R6R:R8R/R=(R)R9R+R7((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyR<�s	c
C@sLtjt|�dtdtdtjdtj�}|j|�\}}|S(s9filter string S through command CMD, returning its outputR-R.R8R/(R0R1R2R4R5R6tcommunicate(tsR)R7tpouttperr((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt
pipefilter�s
cC@s|d
\}}ztjdd�\}}tj|d�}|j|�|j�tjdd�\}}tj|�|jd|�}|jd|�}t|�}tj	dkr�|d@r�d	}n|r�t
jtd
�|t
|�f��nt|d��}|j�SWdQXWdy|r4tj|�nWntk
rHnXy|rbtj|�nWntk
rvnXXdS(s�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.tprefixs
hg-filter-in-Rshg-filter-out-tINFILEtOUTFILEtOpenVMSiiscommand '%s' failed: %sR%N(NN(tNoneRtmkstemptostfdopentwriteRtreplacetsystemtsysplatformRtAbortRRtopentreadtunlinktOSError(R@R)tinnametoutnametinfdR
toutfdR((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt
tempfilter�s8


	

s	tempfile:spipe:cC@sVxFtj�D]8\}}|j|�r
|||t|�j��Sq
Wt||�S(sIfilter a string through a command that transforms its input to its output(t_filtertablet	iteritemst
startswithtlentlstripRC(R@R)tnametfn((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytfilter�s!cC@s1tjtd�p0tjtd�p0tjd�S(s�return True if we are a frozen executable.

    The code supports py2exe (most common, Windows only) and tools/freeze
    (portable, not much used).
    tfrozent	importersu__main__(Rtsafehasattrtsystimpt	is_frozen(((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt
mainfrozen�scC@s�td
kr�tjjd�}tjd}|r>t|�q�t�r�t	tdd
�dkrsttjd�q�tt
j�q�tj
jt
jt	|dd���dkr�tt
j|j��q�td�p�tj
jtjd	�}t|�ntS(s]return location of the 'hg' executable.

    Defaults to $HG or 'hg' in the search path.
    tHGt__main__Rbt
macosx_apptEXECUTABLEPATHt__file__tthgiN(t
_hgexecutableRHRtenvirontgetRetmodulest_sethgexecutableRhRRt
sysexecutableRJtpathtbasenametfsencodeRmtfindexetargv(Rotmainmodtexe((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pythgexecutable�s

		$%
cC@s
|adS(s#set location of the 'hg' executableN(Rp(Rv((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyRt�scC@sKt|dd�}y|o-|�|j�kSWntjk
rFtSXdS(Ntfileno(RRHR~tiotUnsupportedOperationR	(tftstdfR~((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt_testfilenos
cC@st|tj�S(N(R�Ret	__stdin__(R�((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytisstdinscC@st|tj�S(N(R�Ret
__stdout__(R�((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytisstdout
scC@s�|j�||}}t|t�r�tj|j��}tjtjtj�}tj	||j��tj
|�tj|d�}nt|t�r�tj|j��}tj	t
j�|j��tj|d�}n||fS(s�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.
    R%R(tflushR�R8RJtdupR~RQtdevnulltO_RDONLYtdup2RRKR/R=(tuintuouttfintfouttnewfdtnullfd((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytprotectstdio
s



cC@sl|j�x[||f||fgD]A\}}||k	r#tj|j�|j��|j�q#q#WdS(s@Restore (uin, uout) streams from possibly duplicated (fin, fout)N(R�RJR�R~R(R�R�R�R�R�tuif((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytrestorestdio%s

%cc@s?t||�\}}z||fVWdt||||�XdS(s.Run code block with protected standard streamsN(R�R�(R�R�R�R�((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytprotectedstdio-sc@sUd��ttj�}|rD|j�fd�|j�D��nt�|d<|S(s>return environ with optional override, useful for shelling outcS@s9|dks|tkrdS|tkr,dStj|�S(s9convert python object into string that is useful to shellt0t1N(RHR	R4Rtbytestr(tval((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytpy2shell8s
c3@s'|]\}}|�|�fVqdS(N((t.0tktv(R�(s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pys	<genexpr>AsRi(tdictRRqtupdateR[R}(RqR9((R�s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytshellenviron6s	&
cC@stj|t|��S(N(tplatformt
shelltocmdexeR�(R)R9((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt
shelltonativeFscC@s|S(N((R)R9((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyR�KscC@stjt|�S(sMconvert the environment from bytes to strings suitable for Popen(), etc.
    (RtrapplyR2(R9((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyR:PscC@sKytj�Wntk
r!nXt|�}t|�}|dksRt|�r�tjt	|�dt
dtdt|�dt
jt	|��}n�tjt	|�dt
dtdt|�dt
jt	|�dtjdtj�}x*t|jjd�D]}|j|�q�W|j�|j}t
jdkrG|d	@rGd
}n|S(s�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.R-R.R9tcwdR/R=RnRGiiN(R/R�t	ExceptionR3R�RHR�R0tcallR2R4R5R:RR�R1R6tSTDOUTRtreadlineRLRt
returncodeRO(R)RqR�toutR9trcRtline((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyRNUs0
	
		cC@s\tjr?dtjkrtSttdd�r8tj�St	Sntj
pWtjjd�SdS(sAre we running in a GUI?tSSH_CONNECTIONtisguitDISPLAYN(RtisdarwinRRqR	RRRHR�R4t	iswindowsRr(((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytguius	
cC@sCt�r<ttdd�dkr/tjdgStjgSnt�S(s�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.
    RbRkRlN(	RhRReRHRRqRRut	_gethgcmd(((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pythgcmd�s
	
c@s�t���fd�}d}ttdd�}|dk	rQtj||�}nzXt|�}xA|�s�|�ks�t|�r�|�r�dStjd�qcW|SWd|dk	r�tjtj|�nXdS(s_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.
    c@s�jtj��dS(N(taddRJR(tsignumtframe(t
terminated(s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pythandler�stSIGCHLDi����g�������?N(	tsetRHRtsignalt
spawndetachedttestpidttimetsleepR�(targstcondfnR�tprevhandlerR�tpid((R�s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytrundetached�s 	
c#@s�tjtj�g�g����fd�}z;ytjtj|�Wntk
rd�d=nXdVWd�r�tjtj�d�n�r�t�nXdS(s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.
    c@s;��r*tjtj�d��d=n�jt�dS(Ni(R�tSIGINTtappendR4(R�(toldsiginthandlert
shouldbailtwarn(s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytdisabledsiginthandler�s	
iN(R�t	getsignalR�t
ValueErrortKeyboardInterrupt(R�R�((R�R�R�s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pytuninterruptable�s
	(Vt
__future__Rt
contextlibRfRRJR�R0ReR�ti18nRRnRRRRt	importmodRR=R8R/RR�RKR~RR�t	winstdoutR
RytgethgcmdR�tgetusertgetpidt
hidewindowR3treadpipet	setbinarytsetsignalhandlert
shellquotet
shellsplitR�tsshargsR�tsetprocnameRt
unblocksignaltisposixR5RtobjectRR,R&R'RHR;R>R<RCRYRZRaRhRpR}RtR�R�R�R�R�tcontextmanagerR�R�R�tstrfromlocalR2tidentityR:RNR�R�R�R�(((s>/usr/lib64/python2.7/site-packages/mercurial/utils/procutil.pyt<module>
s�"																					



							#
		
													 			#