Your IP : 3.142.172.250


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/pty.cpython-35.opt-2.pyc



���]��@s�ddlmZddlZddlZdddgZdZdZdZdZdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zeedd�Zeedd�ZdS)�)�selectN�openpty�fork�spawn��cCsNytj�SWnttfk
r(YnXt�\}}t|�}||fS)N)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�(/opt/alt/python35/lib64/python3.5/pty.pyrscCs^ytj�\}}Wnttfk
r0Yn'Xtj|�}tj|�||fSt�S)N)rrr	r
�ttyname�closer)r
rrrrr�master_open!s

rc
Cs�xmdD]e}x\dD]T}d||}ytj|tj�}Wntk
rXwYnX|d||fSWqWtd��dS)NZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)r�open�O_RDWRr
)�x�yZpty_name�fdrrrr1s


rcCs�tj|tj�}yddlm}m}Wntk
rG|SYnXy$|||d�|||d�Wntk
r�YnX|S)Nr)�ioctl�I_PUSHZptemZldterm)rrrZfcntlrr�ImportErrorr
)Ztty_name�resultrrrrrr=s
	
rcCs6ytj�\}}Wnttfk
r0Yn:X|tkr`ytj�Wntk
r_YnX||fSt�\}}tj�}|tkrtj�tj|�tj	|t
�tj	|t�tj	|t�|tkr�tj|�tj
tjt�tj�}tj|�n
tj|�||fS)N)r�forkptyr	r
�CHILD�setsidrrr�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidrr
rZtmp_fdrrrrOs0





cCs3x,|r.tj||�}||d�}qWdS)N)r�write)r�data�nrrr�_writenws	r)cCstj|d�S)Ni)r�read)rrrr�_read}sr+cCs�|tg}x�t|gg�\}}}||krh||�}|sX|j|�ntjt|�t|kr|t�}|s�|jt�qt||�qWdS)N)r"r�removerr&r#r))r
�master_read�
stdin_read�fdsZrfdsZwfdsZxfdsr'rrr�_copy�sr0cCs�t|�td�kr!|f}t�\}}|tkrPtj|d|�y&tjt�}tjt�d}Wntj	k
r�d}YnXyt
|||�Wn.tk
r�|r�tjttj
|�YnXtj|�tj|d�dS)N�rr)�typerrr�execlp�ttyZ	tcgetattrr"Zsetraw�errorr0r
Z	tcsetattrZ	TCSAFLUSHr�waitpid)�argvr-r.r%r
�modeZrestorerrrr�s$	



)rrr4�__all__r"r#r$rrrrrrr)r+r0rrrrr�<module>	s (

?>