관리-도구
편집 파일: popen_spawn_win32.cpython-36.opt-2.pyc
3 \� � @ s� d dl Z d dlZd dlZd dlZd dlZddlmZmZmZ ddl m Z ddl mZ dgZdZ ejdkoreed d �Zejj� jd�ZG dd� de�ZdS ) � N� )� reduction�get_spawning_popen�set_spawning_popen)�spawn)�util�Popeni Zwin32�frozenFzpythonservice.exec @ s: e Zd ZdZdd� Zdd� Zd dd�Zd d � Zdd� ZdS )r r c C s t j|j�}tjd d�\}}tj|d�}t jtj � |d�}dj dd� |D ��}t|ddd���}y4tjt j � |d d d dd d d � \}} } }tj| � W n tj|� � Y nX | | _d | _|| _t|�| _tj| tj| jf� t| � ztj||� tj||� W d td � X W d Q R X d S ) Nr )Z parent_pidZpipe_handle� c s s | ]}d | V qdS )z"%s"N� )�.0�xr r �9/usr/lib64/python3.6/multiprocessing/popen_spawn_win32.py� <genexpr>) s z!Popen.__init__.<locals>.<genexpr>�wbT)�closefdF)r Zget_preparation_data�_name�_winapiZ CreatePipe�msvcrtZopen_osfhandleZget_command_line�os�getpid�join�openZ CreateProcessZget_executableZCloseHandle�pid� returncode�_handle�int�sentinelr ZFinalizer r �dump)�selfZprocess_objZ prep_dataZrhandleZwhandleZwfd�cmdZto_childZhpZhtr �tidr r r �__init__ s2 zPopen.__init__c C s t j|| j�S )N)r Z duplicater )r Zhandler r r �duplicate_for_childE s zPopen.duplicate_for_childNc C st | j d krn|d krtj}ntdt|d d ��}tjt| j�|�}|tjkrntj| j�}|t krht j }|| _ | j S )Nr i� g �?)r r ZINFINITE�maxr ZWaitForSingleObjectr Z WAIT_OBJECT_0ZGetExitCodeProcess� TERMINATE�signal�SIGTERM)r �timeoutZmsecs�res�coder r r �waitI s z Popen.waitc C s | j dd�S )Nr )r( )r+ )r r r r �pollY s z Popen.pollc C sL | j d krHytjt| j�t� W n& tk rF | jdd�d krB� Y nX d S )Ng �?)r( )r r ZTerminateProcessr r r% �OSErrorr+ )r r r r � terminate\ s zPopen.terminate)N) �__name__� __module__�__qualname__�methodr"