
    ~f:	                     H    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y)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               || fS 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      O/var/www/cvtools/html/venv/lib/python3.12/site-packages/ptyprocess/_fork_pty.pyfork_ptyr   	   s     **,Ix1}1+,,
'')C
e|
 *
,'
-(
-( 	> 		>    c                 L   t        j                  |       }	 t        j                  dt         j                  t         j                  z        }t        j
                  |       t        j                          	 t        j                  dt         j                  t         j                  z        }t        j
                  |       t        d      # t        $ r(}|j                  t        j                  k7  r Y d}~d}~ww xY w# t        $ r(}|j                  t        j                  k7  r Y d}~nd}~ww xY wt        j                  |t         j                        }t        j
                  |       t        j                  dt         j                        }t        j
                  |       y)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   +   s   
 F#J
WWZR[[!89

 IIKWWZR[[!89
HII  99# $  99# $
 
RYY	'BHHRL 
R[[	)BHHRLs1   A
C 6AC? 	C<C77C<?	D0D++D0)__doc__r
   r   ptyr   r   r   r   utilr   r   r    r   r   <module>r(      s$    	  C C ! D#r   