ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python311/lib64/python3.11/__pycache__/pty.cpython-311.pyc

�

�f����dZddlmZddlZddlZddlZddlmZmZddlmZmZm	Z	gd�Z
dZdZdZ
dZd	�Zd
�Zd�Zd�Zd
�Zd�Zeefd�Zeefd�ZdS)zPseudo terminal utilities.�)�selectN)�close�waitpid)�setraw�	tcgetattr�	tcsetattr)�openpty�fork�spawn��c��	tj��S#ttf$rYnwxYwt	��\}}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_fds   �*/opt/alt/python311/lib64/python3.11/pty.pyr	r	s`��
��z�|�|����G�$�
�
�
���
����*�,�,��I�z��*�%�%�H��h��s��)�)c���	tj��\}}tj|��}tj|��||fS#tt
f$rYnwxYwt
��S)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.)rr	�ttynamerrrr)rrrs   r�master_openr&sx��
%� �j�l�l��	�8��Z��)�)�
�
�������*�$�$��
�G�$�
�
�
���
�������s�A�A�Ac��dD]M}dD]H}d|z|z}	tj|tj��}n#t$rY�7wxYw|d|z|zfccS�Ntd���)z1Open pty master and return (master_fd, tty_name).�pqrstuvwxyzPQRST�0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)r�open�O_RDWRr)�x�y�pty_name�fds    rrr6s���
�,�,��#�	,�	,�A�!�A�~��)�H�
��W�X�r�y�1�1�����
�
�
���
�����
�Q���*�+�+�+�+�+�+�
	,��&�
'�
'�'s�2�
?�?c���tj|tj��}	ddlm}m}n#t$r|cYSwxYw	|||d��|||d��n#t$rYnwxYw|S)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_PUSH�ptem�ldterm)rrr�fcntlr%r&�ImportErrorr)�tty_name�resultr%r&s    rrrBs����W�X�r�y�
)�
)�F��'�'�'�'�'�'�'�'�'�������
�
�
�����
�
��f�f�f�%�%�%�
��f�f�h�'�'�'�'���
�
�
���
�����Ms�*�9�9�A�
A%�$A%c��	tj��\}}|tkr%	tj��n#t$rYnwxYw||fS#t
tf$rYnwxYwt
��\}}tj��}|tkr�tj��tj|��tj	|t��tj	|t��tj	|t��|tkrtj|��tj
tjt��tj��}tj|��ntj|��||fS)zdfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.)r�forkpty�CHILD�setsidrrr	r
r�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidr#rr�tmp_fds     rr
r
Tse����*�,�,���R��%�<�<�
��	�������
�
�
���
�����B�w���
�G�$�
�
�
���
����"�)�)��I�x�
�'�)�)�C�
�e�|�|�
�	����
������	���,�'�'�'�
���-�(�(�(�
���-�(�(�(��m�#�#��H�X��������M�2�2�B�I�>�>��
�������
�������	�>�s �A�8�
A�A�A �A c�,�tj|d��S)zDefault read function.i)r�read)r#s r�_readr9|s��
�7�2�t����c��tj|��rZtj|d��	t|||���tj|d��n#tj|d��wxYwdSd}|tk}|t
k}d}d}	g}g}	|r-t
|��|kr|�t��|r(t
|��|kr|�|��|r-t
|��dkr|	�t
��t
|��dkr|	�|��t||	g��\}}	}
t
|	vr8	tj	t
|��}||d�}n#t$rd}YnwxYw||vr(	||��}n#t$rd}YnwxYw|sdS||z
}||	vrtj	||��}||d�}|r#t|vr|t��}|sd}n||z
}���)	z�Parent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)F)�master_read�
stdin_readTNir:rr)r�get_blocking�set_blocking�_copyr2r3�len�appendr�writer)
rr<r=�high_waterlevel�stdin_avail�stdout_avail�i_buf�o_buf�rfds�wfds�_xfds�n�datas
             rr@r@�sx��

��y�!�!�
�	��	�5�)�)�)�	-��)���L�L�L�L�
�O�I�t�,�,�,�,��B�O�I�t�,�,�,�,�������O��|�+�K��
�-�L��E��E�*������	&�3�u�:�:��7�7��K�K��%�%�%��	#�C��J�J��8�8��K�K�	�"�"�"��	'�C��J�J��N�N��K�K�
�&�&�&��u�:�:��>�>��K�K�	�"�"�"�"�4��r�2�2���d�E��D� � �
%��H�]�E�2�2���a�b�b�	�����
%�
%�
%�$����
%��������
�"�{�9�-�-�����
�
�
�����
�����
����T�M�E��������E�*�*�A��!�"�"�I�E��	�<�4�/�/��:�l�+�+�D��
�#�����
��U*s/�A�A*�$F�F�F�F'�'F6�5F6c�d�t|��td��kr|f}tjd|��t��\}}|tkrtj|dg|�R�	tt��}tt��d}n#tj$rd}YnwxYw	t|||��|r tttj|��n(#|r!tttj|��wwxYwt|��t!|d��dS)zCreate a spawned process.�z	pty.spawnrTFr)�type�sys�auditr
r/r�execlprr2r�tty�errorr@r�	TCSAFLUSHrr)�argvr<r=r5r�mode�restores       rrr�s2���D�z�z�T�"�X�X����w���I�k�4� � � ��V�V�N�C��
�e�|�|�
�	�$�q�'�!�D�!�!�!�!����&�&���|���������9������������9�
�i��j�1�1�1��	9��l�C�M�4�8�8�8����	9��l�C�M�4�8�8�8�8�	9����
�)�����3��?�?�1��s�.*B�B-�,B-�1C%�%%D
)�__doc__rrrQrTrrrrr�__all__r2r3r4r/r	rrrr
r9r@r�r:r�<module>r]s-�� � �������	�	�	�	�
�
�
�
�
�
�
�
���������,�,�,�,�,�,�,�,�,�,�
&�
&�
&�����
��
�	��
�
�
���� 
(�
(�
(����$&�&�&�P���"'�5�?�?�?�?�B"�e������r:

Zerion Mini Shell 1.0