����JFIF���������
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
python310
/
lib64
/
python3.10
/
__pycache__
/
Filename :
pty.cpython-310.opt-1.pyc
back
Copy
o �����=?h]����������������������@���s����d�Z�ddlmZ�ddlZddlZddlZddlmZmZ�ddlmZmZm Z �g�d�Z dZdZdZ dZd d ��Zdd��Zd d��Zdd��Zdd��Zdd��Zdd��Zeefdd�Zeefdd�ZdS�)zPseudo terminal utilities.�����)�selectN)�close�waitpid)�setraw� tcgetattr� tcsetattr)�openpty�fork�spawn��������c��������������� ���C���s<���zt����W�S��ttfy���Y�nw�t��\}�}t|�}|�|fS�)zdopenpty() -> (master_fd, slave_fd) Open a pty master/slave pair, using os.openpty() if possible.)�osr����AttributeError�OSError�_open_terminal� slave_open)� master_fd� slave_name�slave_fd��r����*/opt/alt/python310/lib64/python3.10/pty.pyr������s��� � r���c��������������� ���C���sH���zt����\}�}W�n �ttfy���Y�t��S�w�t��|�}t��|��|�|fS�)z�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.)r ���r���r���r����ttynamer���r���)r���r���r���r���r���r����master_open&���s���� r���c��������������� ���C���sd���dD�]+}�dD�]&}d|��|�}z t��|t�j�}W�n �ty ���Y�qw�|d|��|�f����S�qtd��)z1Open pty master and return (master_fd, tty_name).ZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)r ����open�O_RDWRr���)�x�yZpty_name�fdr���r���r���r���6���s�����r���c�����������������C���sn���t��|�t�j�}z ddlm}m}�W�n�ty���|�Y�S�w�z|||d��|||d��W�|S��ty6���Y�|S�w�)z�slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.r���)�ioctl�I_PUSHZptemZldterm)r ���r���r���Zfcntlr���r����ImportErrorr���)Ztty_name�resultr���r���r���r���r���r���B���s������r���c��������������� ���C���s����zt����\}�}W�n�ttfy���Y�nw�|�tkr.z t�����W�|�|fS��ty-���Y�|�|fS�w�|�|fS�t��\}}t����}�|�tkrvt�����t��|��t�� |t ��t�� |t��t�� |t��|tkrct��|��t�� t��t�t�j�}t��|��|�|fS�t��|��|�|fS�)zdfork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.)r ����forkptyr���r����CHILD�setsidr���r ���r����dup2�STDIN_FILENO� STDOUT_FILENO� STDERR_FILENOr���r���r���)�pidr���r���r���Ztmp_fdr���r���r���r ���T���s:���� �� �r ���c�����������������C���s(���|rt��|�|�}||d��}|sdS�dS�)z#Write all the data to a descriptor.N)r ����write)r����data�nr���r���r����_writen|���s����r-���c�����������������C���s���t��|�d�S�)zDefault read function.i���)r ����read)r���r���r���r����_read����s���r/���c�����������������C���s����|�t�g}|rHt|g�g��\}}}|�|v�r/z||��}W�n�ty$���d}Y�nw�|s)dS�t�t|��t�|v�rD|t��}|s?|�t���nt|�|��|sdS�dS�)z�Parent copy loop. Copies pty master -> standard output (master_read) standard input -> pty master (stdin_read)�����N)r&���r���r���r ���r*���r'����remover-���)r����master_read� stdin_readZfdsZrfdsZ_wfdsZ_xfdsr+���r���r���r����_copy����s$���� �r4���c�������������� ���C���s����t�|��t�d�kr|�f}�t�d|���t��\}}|tkr%tj|�d�g|��R����ztt�}t t��d}W�n�t jy=���d}Y�nw�zt|||��W�|rOt tt j|��n|rZt tt j|��w�w�t|��t|d�d�S�)zCreate a spawned process.��z pty.spawnr���TFr���)�type�sys�auditr ���r#���r ����execlpr���r&���r����tty�errorr4���r���Z TCSAFLUSHr���r���)�argvr2���r3���r)���r����modeZrestorer���r���r���r �������s.��� ����r ���)�__doc__r���r ���r7���r:���r���r���r���r���r����__all__r&���r'���r(���r#���r���r���r���r���r ���r-���r/���r4���r ���r���r���r���r����<module>���s*����(