Your IP : 18.116.24.238


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/pty.cpython-33.pyo

�
��f�c@s�dZddlmZddlZddlZdddgZdZdZdZdZd	d�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zeedd�Zeedd�ZdS(uPseudo terminal utilities.i(uselectNuopenptyuforkuspawniicCsNytj�SWnttfk
r(YnXt�\}}t|�}||fS(udopenpty() -> (master_fd, slave_fd)
    Open a pty master/slave pair, using os.openpty() if possible.(uosuopenptyuAttributeErroruOSErroru_open_terminalu
slave_open(u	master_fdu
slave_nameuslave_fd((u(/opt/alt/python33/lib64/python3.3/pty.pyuopenptyscCs^ytj�\}}Wnttfk
r0Yn'Xtj|�}tj|�||fSt�S(u�master_open() -> (master_fd, slave_name)
    Open a pty master and return the fd, and the filename of the slave end.
    Deprecated, use openpty() instead.(uosuopenptyuAttributeErroruOSErroruttynameucloseu_open_terminal(u	master_fduslave_fdu
slave_name((u(/opt/alt/python33/lib64/python3.3/pty.pyumaster_open!s

umaster_openc#Csyddl}Wntk
r$YndXy"|jtjdd�\}}Wn4tk
r}}ztj|��WYdd}~XnX||fSxpdD]h}x_dD]W}d||}ytj|tj�}Wntjk
r�w�YnX|d||fSWq�Wtjd��dS(	ulOpen pty master and return (master_fd, tty_name).
    SGI and generic BSD version, for when openpty() fails.iNi�upqrstuvwxyzPQRSTu0123456789abcdefu/dev/ptyu/dev/ttyuout of pty devices(usgiuImportErroru_getptyuosuO_RDWRuIOErroruerroruopen(usgiutty_nameu	master_fdumsguxuyupty_nameufd((u(/opt/alt/python33/lib64/python3.3/pty.pyu_open_terminal1s$
""


u_open_terminalcCs�tj|tj�}yddlm}m}Wntk
rG|SYnXy$|||d�|||d�Wntk
r�YnX|S(u�slave_open(tty_name) -> slave_fd
    Open the pty slave and acquire the controlling terminal, returning
    opened filedescriptor.
    Deprecated, use openpty() instead.i(uioctluI_PUSHuptemuldterm(uosuopenuO_RDWRufcntluioctluI_PUSHuImportErroruIOError(utty_nameuresultuioctluI_PUSH((u(/opt/alt/python33/lib64/python3.3/pty.pyu
slave_openHs
	
u
slave_opencCs<ytj�\}}Wnttfk
r0Yn=X|tkrcytj�Wqctk
r_YqcXn||fSt�\}}tj�}|tkr%tj�tj|�tj	|t
�tj	|t�tj	|t�|tkr�tj|�ntj
tjt�tj�}tj|�n
tj|�||fS(udfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.(uosuforkptyuAttributeErroruOSErroruCHILDusetsiduopenptyuforkucloseudup2uSTDIN_FILENOu
STDOUT_FILENOu
STDERR_FILENOuopenuttynameuO_RDWR(upidufdu	master_fduslave_fdutmp_fd((u(/opt/alt/python33/lib64/python3.3/pty.pyuforkZs0




cCs3x,|r.tj||�}||d�}qWdS(u#Write all the data to a descriptor.N(uosuwrite(ufdudataun((u(/opt/alt/python33/lib64/python3.3/pty.pyu_writen�s	u_writencCstj|d�S(uDefault read function.i(uosuread(ufd((u(/opt/alt/python33/lib64/python3.3/pty.pyu_read�su_readcCs�|tg}x�t|gg�\}}}||krk||�}|sX|j|�qktjt|�nt|kr|t�}|s�|jt�q�t||�qqdS(u�Parent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)N(uSTDIN_FILENOuselecturemoveuosuwriteu
STDOUT_FILENOu_writen(u	master_fdumaster_readu
stdin_readufdsurfdsuwfdsuxfdsudata((u(/opt/alt/python33/lib64/python3.3/pty.pyu_copy�su_copycCs�t|�td�kr$|f}nt�\}}|tkrVtj|d|�ny&tjt�}tjt�d}Wntj	k
r�d}YnXyt
|||�Wn7ttfk
r�|r�tj
ttj|�nYnXtj|�dS(uCreate a spawned process.uiiN(utypeuforkuCHILDuosuexeclputtyu	tcgetattruSTDIN_FILENOusetrawuerroru_copyuIOErroruOSErroru	tcsetattru	TCSAFLUSHuclose(uargvumaster_readu
stdin_readupidu	master_fdumodeurestore((u(/opt/alt/python33/lib64/python3.3/pty.pyuspawn�s"

(u__doc__uselectuosuttyu__all__uSTDIN_FILENOu
STDOUT_FILENOu
STDERR_FILENOuCHILDuopenptyumaster_openu_open_terminalu
slave_openuforku_writenu_readu_copyuspawn(((u(/opt/alt/python33/lib64/python3.3/pty.pyu<module>s"(

?>