U e5d@sddlZddlZddlZddlZddlZddlmZmZmZddl m Z ddl m Z dgZ dZ ejdkoreed d Zejd Zd d Zeejej ZddZGdddeZdS)N) reductionget_spawning_popenset_spawning_popen)spawn)utilPopeniZwin32frozenFzpythonservice.execCs ||kptj|tj|kSN)ospathnormcase)Zp1Zp2r9/usr/lib64/python3.8/multiprocessing/popen_spawn_win32.py_path_eqsrcGs|D]}t|qdSr )_winapi CloseHandle)Zhandleshandlerrr_close_handlessrc@sFeZdZdZddZddZdddZd d Zd d ZeZ d dZ dS)rrc CsTt|j}tdd\}}t|d}tjt |d}d dd|D}t }t rt |tjrtj}tj}tj|d<nd}t|ddd } z0t||ddd d|dd \} } } } t| Wnt|YnX| |_d|_| |_t| |_t|t|jt|f|_t|zt !|| t !|| W5tdXW5QRXdS) Nr)Z parent_pidZ pipe_handle css|]}d|VqdS)z"%s"Nr).0xrrr 9sz!Popen.__init__..__PYVENV_LAUNCHER__wbT)closefdF)"rZget_preparation_data_namerZ CreatePipemsvcrtZopen_osfhandleZget_command_liner getpidjoinZget_executableWINENVrsys executable_base_executableenvironcopyopenZ CreateProcessrpid returncode_handleintsentinelrZFinalizer finalizerrrdump)selfZ process_objZ prep_dataZrhandleZwhandleZwfdcmdZ python_exeenvZto_childZhpZhtr'tidrrr__init__,sT          zPopen.__init__cCst||jSr )rZ duplicater+)r.rrrrduplicate_for_childaszPopen.duplicate_for_childNcCst|jdkrn|dkrtj}ntdt|dd}tt|j|}|tjkrnt|j}|t krht j }||_|jS)Nrig?) r(rZINFINITEmaxr*ZWaitForSingleObjectr)Z WAIT_OBJECT_0ZGetExitCodeProcess TERMINATEsignalSIGTERM)r.timeoutZmsecsrescoderrrwaites   z Popen.waitcCs |jddS)Nrr8)r;r.rrrpollusz Popen.pollcCsL|jdkrHztt|jtWn&tk rF|jdddkrBYnXdS)Ng?r<)r(rZTerminateProcessr*r)r5OSErrorr;r=rrr terminatexs  zPopen.terminatecCs |dSr )r,r=rrrclosesz Popen.close)N) __name__ __module__ __qualname__methodr2r3r;r>r@killrArrrrr&s5 )r rr6r!rcontextrrrrr__all__r5platformgetattrZWINEXEr"lowerendswithZ WINSERVICErr#r robjectrrrrrs