
    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   )context)
popen_fork)	reduction)spawn)spawnv_passfdsPopenc                       e Zd Zd Zd ZdS )_DupFdc                     || _         d S Nfdselfr   s     L/var/www/html/env/lib/python3.11/site-packages/billiard/popen_spawn_posix.py__init__z_DupFd.__init__   s        c                     | j         S r   r   )r   s    r   detachz_DupFd.detach   s	    wr   N)__name__
__module____qualname__r   r    r   r   r   r      s2              r   r   c                   2     e Zd ZdZeZ fdZd Z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                 :    | j                             |           |S r   )r   appendr   s     r   duplicate_for_childzPopen.duplicate_for_child'   s    		r   c                 F   dt           j        d<   t          j                     ddlm} |                                }| j                            |           t          j	        |j
                  }t          j                    }t          j        |            	 t          j        ||           t          j        ||           t          j        d            n# t          j        d            w xY wd x}x}x}}		 t          j                    \  }}t          j                    \  }}	t          j        ||          }
| j                            ||g           t)          t          j                    |
| j                  | _        || _        t          j        |	dd          5 }|                    |                                           d d d            n# 1 swxY w Y   |||	fD ]}|t          j        |           d S # |||	fD ]}|t          j        |           w xY w)	N1MULTIPROCESSING_FORKING_DISABLEr   )semaphore_tracker)
tracker_fdpipe_handlewbF)closefd)osenvironr   _Django_old_layout_hack__save r'   getfdr   r"   get_preparation_data_nameioBytesIOr   set_spawning_popenr   dumppipeget_command_lineextendr   get_executablepidsentinelopenwritegetvalueclose)r   r   r'   r(   	prep_datafpparent_rchild_wchild_rparent_wcmdfr   s                r   _launchzPopen._launch+   s_   8;
45+---''''''&,,..
	$$$.{/@AA	Z\\"4(((	-N9b)))N;+++&t,,,,G&t,,,,266676Wx	! "		Hg "		GX(J5<> > >CIgw/000%$&&TY DH %DM4777 '1&&&' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 2 ! !>HRLLL! !w2 ! !>HRLLL!s=   *C C-9B(H  !(G	H  GH  GH    H )
r   r   r   methodr   DupFdr   r#   rI   __classcell__)r    s   @r   r	   r	      s`        FE& & & & &  ! ! ! ! ! ! !r   )r3   r,   r/   r   r   r   r   compatr   __all__r   r	   r   r   r   <module>rO      s    				 				                         " " " " " ")       +! +! +! +! +!J +! +! +! +! +!r   