[@sddlZddlZddlmZejs@ednddlmZddlmZddlmZddlm Z dd lm Z d gZ Gd d d e Z Gd d d ejZdS)N) reductionz,No support for sending fds between processes)context) forkserver) popen_fork)spawn)utilPopenc@s(eZdZddZddZdS)_DupFdcCs ||_dS)N)ind)selfr r 6/usr/lib/python3.4/multiprocessing/popen_forkserver.py__init__sz_DupFd.__init__cCstj|jS)N)rZget_inherited_fdsr )r r r rdetachsz _DupFd.detachN)__name__ __module__ __qualname__rrr r r rr s  r csXeZdZdZeZfddZddZddZe j dd Z S) r rcsg|_tj|dS)N)_fdssuperr)r process_obj) __class__r rr"s zPopen.__init__cCs!|jj|t|jdS)Nr)rappendlen)r fdr r rduplicate_for_child&szPopen.duplicate_for_childcCstj|j}tj}tj|z$tj||tj||WdtjdXt j |j \|_ }t j|tj|j ft|ddd}|j|jWdQXt j|j |_dS)NwbclosefdT)rZget_preparation_data_nameioBytesIOrZset_spawning_popenrdumprZconnect_to_new_processrsentinelrZFinalizeoscloseopenwrite getbuffer read_unsignedpid)r rZ prep_dataZbufwfr r r_launch*s  z Popen._launchc Cs|jdkrddlm}|tjkr4dnd}||jg|sSdSytj|j|_Wqtt fk rd|_YqXn|jS)Nr)wait) returncodeZmultiprocessing.connectionr-r#WNOHANGr"rr(OSErrorEOFError)r Zflagr-Ztimeoutr r rpoll:sz Popen.poll) rrrmethodr ZDupFdrrr,r#r0r3r r )rrr s   )rr#rZHAVE_SEND_HANDLE ImportErrorrrrrr__all__objectr r r r r rs