o
    ¡D®f‚  ã                   @   sv   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
„ d
ƒZ
G dd„ dejƒZdS )é    Né   )Úcontext)Ú
popen_fork)Ú	reduction)Úspawn)Úspawnv_passfdsÚPopenc                   @   s   e Zd Zdd„ Zdd„ ZdS )Ú_DupFdc                 C   s
   || _ d S ©N©Úfd©Úselfr   © r   úS/home/ubuntu/webapp/venv/lib/python3.10/site-packages/billiard/popen_spawn_posix.pyÚ__init__   s   
z_DupFd.__init__c                 C   s   | j S r
   r   )r   r   r   r   Údetach   s   z_DupFd.detachN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r	      s    r	   c                       s4   e Zd ZdZeZ‡ fdd„Zdd„ Zdd„ Z‡  Z	S )r   r   c                    s   g | _ tƒ  |¡ d S r
   )Ú_fdsÚsuperr   )r   Úprocess_obj©Ú	__class__r   r   r   #   s   zPopen.__init__c                 C   s   | j  |¡ |S r
   )r   Úappendr   r   r   r   Úduplicate_for_child'   s   zPopen.duplicate_for_childc              
   C   sp  dt jd< t ¡  ddlm} | ¡ }| j |¡ t 	|j
¡}t ¡ }t | ¡ zt ||¡ t ||¡ W t d ¡ nt d ¡ w d  } } }}	z[t  ¡ \}}t  ¡ \}}	tj||d}
| j ||g¡ tt ¡ |
| jƒ| _|| _tj|	ddd}| | ¡ ¡ W d   ƒ n1 sw   Y  W |||	fD ]}|d ur£t  |¡ q˜d S |||	fD ]}|d ur¶t  |¡ q«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   r   r   r   Ú_launch+   sJ   

ÿÿÿ€
€þ
€þzPopen._launch)
r   r   r   Úmethodr	   ÚDupFdr   r   rA   Ú__classcell__r   r   r   r   r      s    )r+   r$   r'   r   r   r   r   Úcompatr   Ú__all__r	   r   r   r   r   r   Ú<module>   s    