AlkantarClanX12

Your IP : 3.144.89.42


Current Path : /lib64/python3.6/__pycache__/
Upload File :
Current File : //lib64/python3.6/__pycache__/pty.cpython-36.opt-2.pyc

3


 \��@s�ddlmZddlZddlZdddgZdZdZdZdZdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zeefdd�Zeefdd�ZdS)�)�selectN�openpty�fork�spawn��cCs<ytj�Sttfk
r YnXt�\}}t|�}||fS)N)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�/usr/lib64/python3.6/pty.pyrs
cCsLytj�\}}Wnttfk
r(YnXtj|�}tj|�||fSt�S)N)rrr	r
�ttyname�closer)r
rrrrr�master_open!s

rc
Cslx^dD]V}xPdD]H}d||}ytj|tj�}Wntk
rHwYnX|d||fSWqWtd��dS)NZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)r�open�O_RDWRr
)�x�yZpty_name�fdrrrr1s

rcCsntj|tj�}yddlm}m}Wntk
r6|SXy|||d�|||d�Wntk
rhYnX|S)Nr)�ioctl�I_PUSHZptemZldterm)rrrZfcntlrr�ImportErrorr
)Ztty_name�resultrrrrrr=srcCs�ytj�\}}Wnttfk
r(Yn4X|tkrTytj�Wntk
rRYnX||fSt�\}}tj�}|tkr�tj�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



cCs&x |r tj||�}||d�}qWdS)N)r�write)r�data�nrrr�_writenwsr)cCstj|d�S)Ni)r�read)rrrr�_read}sr+cCsz|tg}xlt|gg�\}}}||krH||�}|s<|j|�ntjt|�t|kr
|t�}|sh|jt�q
t||�q
WdS)N)r"r�removerr&r#r))r
�master_read�
stdin_readZfdsZrfdsZwfdsZxfdsr'rrr�_copy�sr/cCs�t|�td�kr|f}t�\}}|tkr<tj|df|��ytjt�}tjt�d}Wntj	k
rrd}YnXyt
|||�Wn(tk
r�|r�tjttj
|�YnXtj|�tj|d�dS)N�rr)�typerrr�execlp�ttyZ	tcgetattrr"Zsetraw�errorr/r
Z	tcsetattrZ	TCSAFLUSHr�waitpid)�argvr-r.r%r
�modeZrestorerrrr�s$




)rrr3�__all__r"r#r$rrrrrrr)r+r/rrrrr�<module>	s 
(