
    Sf                         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lmZ ddlmZ dgZ G d	 d
          Z	 G d dej
                  Z
dS )    N   )	reduction)context)
forkserver)
popen_fork)spawnPopenc                       e Zd Zd Zd ZdS )_DupFdc                     || _         d S N)ind)selfr   s     K/var/www/html/env/lib/python3.11/site-packages/billiard/popen_forkserver.py__init__z_DupFd.__init__   s        c                 >    t          j                    | j                 S r   )r   get_inherited_fdsr   )r   s    r   detachz_DupFd.detach   s    +--dh77r   N)__name__
__module____qualname__r   r    r   r   r   r      s2          8 8 8 8 8r   r   c                   F     e Zd ZdZeZ fdZd Zd Ze	j
        fdZ xZS )r	   r   c                 X    g | _         t                                          |           d S r   )_fdssuperr   )r   process_obj	__class__s     r   r   zPopen.__init__"   s(    	%%%%%r   c                 d    | j                             |           t          | j                   dz
  S )Nr   )r   appendlen)r   fds     r   duplicate_for_childzPopen.duplicate_for_child&   s+    	49~~!!r   c                 b   t          j        |j                  }t          j                    }t          j        |            	 t          j        ||           t          j        ||           t          j        d            n# t          j        d            w xY wt          j
        | j                  \  | _        }t          j        |dd          5 }|                    |                                           d d d            n# 1 swxY w Y   t          j        | j                  | _        d S )NwbT)closefd)r   get_preparation_data_nameioBytesIOr   set_spawning_popenr   dumpr   connect_to_new_processr   sentinelopenwrite	getbufferread_unsignedpid)r   r   	prep_databufwfs         r   _launchzPopen._launch*   s9   .{/@AA	jll"4(((	-N9c***N;,,,&t,,,,G&t,,,,%<TYGGqWQd+++ 	%qGGCMMOO$$$	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%+DM::s   *B B(DD
D
c                     | j         lddlm} |t          j        k    rdnd } || j        g|          sd S 	 t          j        | j                  | _         n# t          t          f$ r
 d| _         Y nw xY w| j         S )Nr   )waitr      )

returncode
connectionr;   osWNOHANGr/   r   r3   OSErrorEOFError)r   flagr;   timeouts       r   pollz
Popen.poll9   s    ?"((((((2:--aa4G411 t&",":4="I"IX& & & &"%& s   A A10A1)r   r   r   methodr   DupFdr   r$   r9   r?   r@   rE   __classcell__)r   s   @r   r	   r	      s{        FE& & & & &" " "; ; ; 
        r   )r*   r?    r   r   r   r   r   __all__r   r	   r   r   r   <module>rK      s    				 				                              )8 8 8 8 8 8 8 8& & & & &J & & & & &r   