3 ^c@sddlZddlZddlmZmZejs.edddlmZddlm Z ddlm Z ddlm Z d gZ Gd d d e ZGd d d e jZdS) N) reductionset_spawning_popenz,No support for sending fds between processes) forkserver) popen_fork)spawn)utilPopenc@seZdZddZddZdS)_DupFdcCs ||_dSN)ind)selfr r 8/usr/lib64/python3.6/multiprocessing/popen_forkserver.py__init__z_DupFd.__init__cCstj|jSr )rZget_inherited_fdsr )r r r rdetachrz _DupFd.detachN)__name__ __module__ __qualname__rrr r r rr sr csBeZdZdZeZfddZddZddZe j fdd Z Z S) rrcsg|_tj|dSr )_fdsZsuperr)r process_objZ __class__r rr!szPopen.__init__cCs|jj|t|jdS)Nr)rZappendZlen)r Zfdr r rduplicate_for_child%s zPopen.duplicate_for_childcCstj|j}tj}t|ztj||tj||WdtdXtj |j \|_ }t j |tj|j ft|ddd}|j|jWdQRXtj|j |_dS)NZwbT)Zclosefd)rZget_preparation_dataZ_nameioZBytesIOrrZdumprZconnect_to_new_processrsentinelrZFinalizeosZcloseZopenZwriteZ getbuffer read_unsignedZpid)r rZ prep_dataZbufZwZfr r r_launch)s   z Popen._launchc Csr|jdkrlddlm}|tjkr$dnd}||jg|s:dSytj|j|_Wntt fk rjd|_YnX|jS)Nr)waiti) Z returncodeZmultiprocessing.connectionrrWNOHANGrrrZOSErrorZEOFError)r ZflagrZtimeoutr r rpoll9s   z Popen.poll) rrrZmethodr ZDupFdrrrrrr Z __classcell__r r rrrs  )rrZcontextrrZHAVE_SEND_HANDLEZ ImportErrorZrrrrZ__all__Zobjectr rr r r rZs