
    ch                     p    d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl	m
Z
 d
dZ G d d	          ZdS )z.
Helper to run a script in a pseudo-terminal.
    N)	ExitStack)EIO)import_module   dummy inputc                    t          d          }t                      }|                                \  }}t          j        d| f}t          j        |||||          }t          j        |           t                      5 }	|	
                    |           d }
|	                    |
|           |	                    t          j        |           |	
                    t          j                              }|                    |t          j        t          j        z             t          j        |d           	 |                                D ]\  }}|t          j        z  rh	 t          j        |d          }n*# t(          $ r}|j        t,          k    r d}Y d }~nd }~ww xY w|s|c cd d d            S |                    |           |t          j        z  rk	 |t          j        ||          d          }n*# t(          $ r}|j        t,          k    r d}Y d }~nd }~ww xY w|s |                    |t          j                   # 1 swxY w Y   d S )	Nptyz-c)stdinstdoutstderrenvc                 R    	 |                                   d S # t          $ r Y d S w xY wN)	terminateProcessLookupError)procs    )  /home/conda/feedstock_root/build_artifacts/python-split_1761172146731/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.11/test/support/pty_helper.pyr   zrun_pty.<locals>.terminate   s?         %   s    
&&FTi       )r   	bytearrayopenptysys
executable
subprocessPopenoscloser   enter_contextcallback	selectorsSelectSelectorregister
EVENT_READEVENT_WRITEset_blockingselectreadOSErrorerrnor   extendwritemodify)scriptinputr   r   outputmasterslaveargsr   cleanupr   sel_eventschunkerrs                   r   run_ptyr7      s   


C[[FkkmmOVUND&)DDeEsSSSDHUOOO	 (Ad###	 	 	 	D)))6*** ##I$<$>$>??VY1I4IIJJJ
&&&	A"zz|| A AFI00 
)$ " 8 8" $ $ $9++! #	$
 ! &%;(A (A (A (A (A (A (A (A< MM%(((I11 	A$ %bhvu&=&=&>&> ?" $ $ $9++! #	$
 ! A

69+?@@@-	A%(A (A (A (A (A (A (A (A (A (Asm   ?C I E65I6
F FIFI2$IG54I5
H?HIH(IIIc                       e Zd ZdZd Zd ZdS )	FakeInputa  
    A fake input stream for pdb's interactive debugger.  Whenever a
    line is read, print it (to simulate the user typing it), and then
    return it.  The set of lines to return is specified in the
    constructor; they should not have trailing newlines.
    c                     || _         d S r   )lines)selfr;   s     r   __init__zFakeInput.__init__J   s    


r   c                 ^    | j                             d          }t          |           |dz   S )Nr   
)r;   popprint)r<   lines     r   readlinezFakeInput.readlineM   s*    z~~a  dd{r   N)__name__
__module____qualname____doc__r=   rC    r   r   r9   r9   C   s<               r   r9   )r   N)rG   r   r   r   r   
contextlibr   r'   r   test.support.import_helperr   r7   r9   rH   r   r   <module>rK      s     
			         



                   4 4 4 4 4 4/A /A /A /Al         r   