
    2 f:	                     J    d Z ddlZddlZddlmZmZmZmZ ddlm	Z	 d Z
d ZdS )z<Substitute for the forkpty system call, to support Solaris.
    N)STDIN_FILENOSTDOUT_FILENOSTDERR_FILENOCHILD   )PtyProcessErrorc                     t          j                    \  } }| dk     s|dk     rt          d          t          j                    }|t          k    rrt          j        |            t          |           t          j        |t                     t          j        |t                     t          j        |t                     nt          j        |           || fS )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   zos.openpty() failed)osopenptyOSErrorforkr   closepty_make_controlling_ttydup2r   r   r   )	parent_fdchild_fdpids      J/var/www/equiseq/venv/lib/python3.11/site-packages/ptyprocess/_fork_pty.pyfork_ptyr   	   s     *,,Ix1}}1+,,,
'))C
e||
 ***
,'''
-(((
-(((( 		>    c                    t          j        |           }	 t          j        dt           j        t           j        z            }t          j        |           n-# t          $ r }|j        t          j        k    r Y d}~nd}~ww xY wt          j	                     	 t          j        dt           j        t           j        z            }t          j        |           t          d          # t          $ r }|j        t          j        k    r Y d}~nd}~ww xY wt          j        |t           j                  }t          j        |           t          j        dt           j                  }t          j        |           dS )zThis 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
WZR[!899
   9## $#### IKKKWZR[!899
HIII   9## $####
 
RY	'	'BHRLLL 
R[	)	)BHRLLLLLs1   A A 
B!A<<BAC' '
D1DD)__doc__r
   r   ptyr   r   r   r   utilr   r   r    r   r   <module>r(      s     				  C C C C C C C C C C C C ! ! ! ! ! !     D# # # # #r   