a XC?hI � @ s6 d dl Z d dlZddlmZ dgZG dd� de�ZdS )� N� )�util�Popenc @ s` e Zd ZdZdd� Zdd� Zejfdd�Zdd d �Z dd� Z d d� Zdd� Zdd� Z dd� ZdS )r �forkc C s" t �� d | _d | _| �|� d S �N)r Z_flush_std_streams� returncode� finalizer�_launch)�self�process_obj� r �?/opt/alt/python39/lib64/python3.9/multiprocessing/popen_fork.py�__init__ s zPopen.__init__c C s |S r r )r �fdr r r �duplicate_for_child s zPopen.duplicate_for_childc C sR | j d u rLzt�| j|�\}}W n ty4 Y d S 0 || jkrLt�|�| _ | j S r )r �os�waitpid�pid�OSError�waitstatus_to_exitcode)r �flagr �stsr r r �poll s z Popen.pollNc C sN | j d u rH|d ur0ddlm} || jg|�s0d S | �|dkrBtjnd�S | j S )Nr )�waitg )r Zmultiprocessing.connectionr �sentinelr r �WNOHANG)r �timeoutr r r r r $ s z Popen.waitc C sV | j d u rRzt�| j|� W n4 ty. Y n$ tyP | jdd�d u rL� Y n0 d S )Ng�������?)r )r r �killr �ProcessLookupErrorr r )r Zsigr r r �_send_signal. s zPopen._send_signalc C s | � tj� d S r )r �signal�SIGTERM�r r r r � terminate8 s zPopen.terminatec C s | � tj� d S r )r r �SIGKILLr" r r r r ; s z Popen.killc C s� d}t �� \}}t �� \}}t �� | _| jdkrnz.t �|� t �|� |j|d�}W t �|� q�t �|� 0 n0t �|� t �|� t�| tj ||f�| _ || _d S )Nr r )Zparent_sentinel)r �piper r �close� _bootstrap�_exitr ZFinalizeZ close_fdsr r )r r �codeZparent_rZchild_wZchild_rZparent_wr r r r > s �z Popen._launchc C s | j d ur| � � d S r )r r" r r r r&