← Back
Editing: _fork_pty.cpython-312.opt-1.pyc
� �% g: � �H � d Z ddlZddlZddlmZmZmZmZ ddlm Z d� Z d� Zy)z<Substitute for the forkpty system call, to support Solaris. � N)�STDIN_FILENO� STDOUT_FILENO� STDERR_FILENO�CHILD� )�PtyProcessErrorc � � t j � \ } }| dk s|dk rt d� �t j � }|t k( rrt j | � t |� t j |t � t j |t � t j |t � || fS t j |� || fS )a� This implements a substitute for the forkpty system call. This should be more portable than the pty.fork() function. Specifically, this should work on Solaris. Modified 10.06.05 by Geoff Marshall: Implemented __fork_pty() method to resolve the issue with Python's pty.fork() not supporting Solaris, particularly ssh. Based on patch to posixmodule.c authored by Noah Spurrier:: http://mail.python.org/pipermail/python-dev/2003-May/035281.html r zos.openpty() failed)�os�openpty�OSError�forkr �close�pty_make_controlling_tty�dup2r r r )� parent_fd�child_fd�pids �9/usr/lib/python3.12/site-packages/ptyprocess/_fork_pty.py�fork_ptyr s� � � �*�*�,��I�x��1�}��1���+�,�,� �'�'�)�C� �e�|� ����� ��*� ����,�'� ����-�(� ����-�(� � �>�� ������ �>�� c �L � t j | � } t j dt j t j z � }t j |� t j � t j dt j t j z � }t j |� t d� �# t $ r(}|j t j k7 r� Y d}~��d}~ww xY w# t $ r(}|j t j k7 r� Y d}~nd}~ww xY wt j |t j � }t j |� t j dt j � }t j |� y)z�This makes the pseudo-terminal the controlling tty. This should be more portable than the pty.fork() function. Specifically, this should work on Solaris. z/dev/ttyNz(OSError of errno.ENXIO should be raised.)r �ttyname�open�O_RDWR�O_NOCTTYr r �errno�ENXIO�setsidr �O_WRONLY)�tty_fd� child_name�fd�errs r r r + s � � ���F�#�J� � �W�W�Z����R�[�[�!8� 9�� ����� �I�I�K�� �W�W�Z����R�[�[�!8� 9�� ������H�I�I�� � ��9�9����#�� $���� � ��9�9����#�� $���� ����R�Y�Y� '�B��H�H�R�L� ����R�[�[� )�B��H�H�R�Ls1 �A C �6AC? � C<�C7�7C<�? D0�D+�+D0)�__doc__r r �ptyr r r r �utilr r r � r r �<module>r( s$ ��� � � C� C� !� �D#r
Save File
Cancel