Your IP : 18.117.74.47


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/pty.cpython-39.opt-2.pyc

a

R�f��@s�ddlmZddlZddlZddlZgd�ZdZdZdZdZdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zeefdd�Zeefdd�ZdS)�)�selectN)�openpty�fork�spawn��c	Cs<z
t��WSttfy Yn0t�\}}t|�}||fS�N)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�(/opt/alt/python39/lib64/python3.9/pty.pyrs

rc	CsJzt��\}}Wnttfy&Yn0t�|�}t�|�||fSt�Sr)r	rr
r�ttyname�closer)rrrrrr�master_open"s

rc
CsldD]Z}dD]P}d||}zt�|tj�}WntyDYqYn0|d||fSqtd��dS)NZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)r	�open�O_RDWRr)�x�yZpty_name�fdrrrr2s
rcCsnt�|tj�}zddlm}m}Wnty8|YS0z|||d�|||d�WntyhYn0|S)Nr)�ioctl�I_PUSHZptemZldterm)r	rrZfcntlrr�ImportErrorr)Ztty_name�resultrrrrrr
>s
r
c	Cs�zt��\}}Wnttfy&Yn20|tkrPzt��WntyNYn0||fSt�\}}t��}|tkr�t��t�|�t�	|t
�t�	|t�t�	|t�|tkr�t�|�t�
t�t�tj�}t�|�n
t�|�||fSr)r	�forkptyr
r�CHILD�setsidrrr�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidrrrZtmp_fdrrrrPs0



rcCs"|rt�||�}||d�}qdSr)r	�write)r�data�nrrr�_writenxsr*cCst�|d�S)Ni)r	�read)rrrr�_read~sr,cCsv|tg}t|gg�\}}}||vrF||�}|s:|�|�nt�t|�t|vr|t�}|sf|�t�qt||�qdSr)r#r�remover	r'r$r*)r�master_read�
stdin_readZfdsZrfdsZwfdsZxfdsr(rrr�_copy�sr0cCs�t|�td�kr|f}t�d|�t�\}}|tkrJtj|dg|�R�zt�t	�}t�
t	�d}Wntjy~d}Yn0zt|||�Wn&t
y�|r�t�t	tj|�Yn0t�|�t�|d�dS)N�z	pty.spawnrr)�type�sys�auditrr r	�execlp�ttyZ	tcgetattrr#Zsetraw�errorr0rZ	tcsetattrZ	TCSAFLUSHr�waitpid)�argvr.r/r&r�modeZrestorerrrr�s&




r)rr	r3r6�__all__r#r$r%r rrrr
rr*r,r0rrrrr�<module>	s"(

?>