AlkantarClanX12

Your IP : 18.222.166.127


Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/pty.cpython-37.opt-2.pyc

B

YI~d��@s�ddlmZddlZddlZdddgZdZdZdZdZdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zeefdd�Zeefdd�ZdS)�)�selectN�openpty�fork�spawn��c	Cs<yt��Sttfk
r YnXt�\}}t|�}||fS)N)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�(/opt/alt/python37/lib64/python3.7/pty.pyrs
c	CsLyt��\}}Wnttfk
r(YnXt�|�}t�|�||fSt�S)N)rrr	r
�ttyname�closer)r
rrrrr�master_open!s

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

rcCsnt�|tj�}yddlm}m}Wntk
r6|SXy|||d�|||d�Wntk
rhYnX|S)Nr)�ioctl�I_PUSHZptemZldterm)rrrZfcntlrr�ImportErrorr
)Ztty_name�resultrrrrrr=src	Cs�yt��\}}Wnttfk
r(Yn4X|tkrTyt��Wntk
rRYnX||fSt�\}}t��}|tkr�t��t�|�t�	|t
�t�	|t�t�	|t�|tkr�t�|�t�
t�t�tj�}t�|�n
t�|�||fS)N)r�forkptyr	r
�CHILD�setsidrrr�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidrr
rZtmp_fdrrrrOs0



cCs&x |r t�||�}||d�}qWdS)N)r�write)r�data�nrrr�_writenwsr)cCst�|d�S)Ni)r�read)rrrr�_read}sr+cCsz|tg}xlt|gg�\}}}||krH||�}|s<|�|�nt�t|�t|kr
|t�}|sh|�t�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|��yt�t�}t�t�d}Wntj	k
rrd}YnXyt
|||�Wn(tk
r�|r�t�ttj
|�YnXt�|�t�|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 
(