File: //opt/alt/python35/lib64/python3.5/multiprocessing/__pycache__/popen_spawn_win32.cpython-35.pyc
��Yf�  �               @   s�   d  d l  Z  d  d l Z d  d l Z 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 g Z
 d Z e j d	 k o� e
 e d
 d � Z e j j �  j d � Z Gd
 d �  d e � Z d S)�    N�   )�context)�spawn)�	reduction)�util�Popeni   �win32�frozenFzpythonservice.exec               @   s[   e  Z d  Z d Z d Z d d �  Z d d �  Z d d d	 � Z d
 d �  Z d d
 �  Z	 d S)r   z@
    Start a subprocess to run the code of a process object
    r   c             C   s�  t  j | j � } t j d  d � \ } } t j | d � } t  j d t j	 �  d | � } d j
 d d �  | D� � } t | d d d	 ��� } yJ t j t  j
 �  | d  d  d
 d d  d  d  �	 \ } }	 }
 } t j |	 � Wn t j | � �  Yn X|
 |  _ d  |  _ | |  _ t | � |  _ t j |  t j |  j f � t j |  � z$ t j | | � t j | | � Wd  t j d  � XWd  QRXd  S)Nr   Z
parent_pidZpipe_handle� c             s   s   |  ] } d  | Vq d S)z"%s"N� )�.0�xr   r   �F/opt/alt/python35/lib64/python3.5/multiprocessing/popen_spawn_win32.py�	<genexpr>*   s    z!Popen.__init__.<locals>.<genexpr>�wb�closefdTF)r   Zget_preparation_data�_name�_winapiZ
CreatePipe�msvcrtZopen_osfhandleZget_command_line�os�getpid�join�openZ
CreateProcessZget_executableZCloseHandle�pid�
returncode�_handle�int�sentinelr   ZFinalizer   Zset_spawning_popenr   �dump)�selfZprocess_objZ	prep_dataZrhandleZwhandleZwfd�cmdZto_childZhpZhtr   �tidr   r   r   �__init__!   s2    	'
			
zPopen.__init__c             C   s+   |  t  j �  k s t � t j | |  j � S)N)r   Zget_spawning_popen�AssertionErrorr   Z	duplicater   )r   Zhandler   r   r   �duplicate_for_childF   s    zPopen.duplicate_for_childNc             C   s�   |  j  d  k r� | d  k r'