• File: popen_spawn.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/usr/lib/python2.7/site-packages/pexpect/popen_spawn.pyc
  • Date Modified: 11/22/2021 6:00 PM
  • File size: 6.17 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

ڛac@sdZddlZddlZddlZddlZddlZddlZddlZyddlm	Z	m
Z
Wn'ek
rddl	m	Z	m
Z
nXddlm
Z
mZddlmZddlmZde
fd	YZdS(
sJProvides an interface like pexpect.spawn interface using subprocess.Popen
iN(tQueuetEmptyi(t	SpawnBasetPY3(tEOF(tstring_typest
PopenSpawnc
BseZdddddddddd	ZeZdZdZdZdZ	dZ
d	d
ZdZdZ
d
ZRS(iitstrictc
Cstt|jd|d|d|d|d|d|	|dkr[tjjd|_n|jtj|_t	dd	d
t
jdt
jdt
jd
|d|
d|}t
jdkrt
j}|jt
jO_||d<t
j|d<nt|tr2t
jdkr2tj|dtjdk}nt
j|||_|jj|_t|_|j|_t|_t j!d|j"|_#|j#j$t%|j#j&dS(Nttimeouttmaxreadtsearchwindowsizetlogfiletencodingtcodec_errorstasciitbufsizeitstdintstderrtstdouttcwdt
preexec_fntenvtwin32tstartupinfot
creationflagstposixttarget('tsuperRt__init__tNonetostlineseptencodetcrlftstring_typetdictt
subprocesstPIPEtSTDOUTtsystplatformtSTARTUPINFOtdwFlagstSTARTF_USESHOWWINDOWtCREATE_NEW_PROCESS_GROUPt
isinstanceRtshlextsplittnametPopentproctpidtFalsetclosedt_bufRt_read_queuet	threadingtThreadt_read_incomingt_read_threadt	setDaemontTruetstart(
tselftcmdRR	R
RRRRR
RtkwargsR((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pyRs0
	
!	cCs<|j}|jrE|r-|||_|| St|_tdn|dkr]|j}n|dkrrd}ntj}xtj||kr|rt||kry|j	j
}Wntk
rPqX|dkrt|_Pn||jj
|dt7}qW|| ||}|_|j|d|S(NsEnd Of File (EOF).ig.Atfinaltread(R6t_read_reached_eofR=tflag_eofRRRttimetlenR7t
get_nowaitRt_decodertdecodeR4t_log(R?tsizeRtbuftt0tincomingtr((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pytread_nonblockingAs0		
		1
	 cCs|jjj}xod}ytj|d}Wn#tk
rV}|j|dnX|sq|jjddS|jj|qdS(s6Run in a thread to move output from a pipe to a queue.tiRCN(
R2RtfilenoRRCtOSErrorRKR7tputR(R?RSRMte((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pyR:dscCs|j|dS(sHThis is similar to send() except that there is no return value.
        N(tsend(R?ts((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pytwriteuscCs"x|D]}|j|qWdS(sThis calls write() for each element in the sequence.

        The sequence can be any iterable object producing strings, typically a
        list of strings. This does not add line separators. There is no return
        value.
        N(RW(R?tsequenceRX((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pyt
writelineszs
cCsq|j|}|j|d|jj|dt}trP|jjj|S|jjj|t	|SdS(sZSend data to the subprocess' stdin.

        Returns the number of bytes written.
        RWRBN(
t_coerce_send_stringRKt_encoderR R4RR2RRYRG(R?RXtb((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pyRWsRRcCs#|j|}||j|jS(sWraps send(), sending string ``s`` to child process, with os.linesep
        automatically appended. Returns number of bytes written. (RWR(R?RXtn((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pytsendlinescCsP|jj}|dkr0||_d|_nd|_||_t|_|S(sKWait for the subprocess to finish.

        Returns the exit code.
        iN(R2twaitt
exitstatusRtsignalstatusR=t
terminated(R?tstatus((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pyRas		
	cCs}tjdkrc|tjtjgkr3tj}qc|tjtjgkrWtj}qctj}ntj	|j
j|dS(s}Sends a Unix signal to the subprocess.

        Use constants from the :mod:`signal` module to specify which signal.
        RN(R'R(tsignaltSIGINTtCTRL_C_EVENTtSIGBREAKtCTRL_BREAK_EVENTtSIGTERMRtkillR2R3(R?tsig((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pyRlscCs|jjjdS(s+Closes the stdin pipe from the writing end.N(R2Rtclose(R?((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pytsendeofsN(t__name__t
__module__RRR4RDRQR:RYR[RWR`RaRlRo(((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pyRs	(	#			
			(t__doc__RR8R$R'RFRfR.tqueueRRtImportErrort	spawnbaseRRt
exceptionsRtutilsRR(((s6/tmp/pip-install-ztITAX/pexpect/pexpect/popen_spawn.pyt<module>s