文件操作 - _fork_pty.cpython-311.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/ptyprocess/__pycache__/_fork_pty.cpython-311.pyc
编辑文件内容
� �.�c: � �J � d Z ddlZddlZddlmZmZmZmZ ddlm Z d� Z d� ZdS )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 � � nt 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 �6/usr/lib/python3/dist-packages/ptyprocess/_fork_pty.py�fork_ptyr s� � � �*�,�,��I�x��1�}�}��1����+�,�,�,� �'�)�)�C� �e�|�|� ������ ��*�*�*� ���,�'�'�'� ���-�(�(�(� ���-�(�(�(�(� ������� �>�� c � � t j | � � } t j dt j t j z � � }t j |� � n-# t $ r }|j t j k r� Y d}~nd}~ww xY wt j � � t j dt j t j z � � }t j |� � t d� � �# t $ r }|j t j k r� Y d}~nd}~ww xY wt j |t j � � }t j |� � t j dt j � � }t j |� � dS )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 + sU � � ��F�#�#�J� � �W�Z���R�[�!8� 9� 9�� ��������� � � ��9���#�#�� $�#�#�#�#��������� �I�K�K�K�� �W�Z���R�[�!8� 9� 9�� �������H�I�I�I��� � � ��9���#�#�� $�#�#�#�#��������� ���R�Y� '� '�B��H�R�L�L�L� ���R�[� )� )�B��H�R�L�L�L�L�Ls1 �A A � B�!A<�<B�AC'