3 \ @sddlZddlZddlZddlZddlZddlmZmZmZddl m Z ddl m Z dgZ dZ ejdkoreed d Zejjjd ZGd ddeZdS) N) reductionget_spawning_popenset_spawning_popen)spawn)utilPopeniZwin32frozenFzpythonservice.exec@s>eZdZdZdZddZddZddd Zd d Zd d Z dS)rz@ Start a subprocess to run the code of a process object rc Cstj|j}tjdd\}}tj|d}tjtj |d}dj dd|D}t |ddd}y4tj tj |ddd dddd \}} } } tj| Wntj|YnX| |_d|_||_t||_tj|tj|jft|ztj||tj||WdtdXWdQRXdS) Nr)Z parent_pidZ pipe_handle css|]}d|VqdS)z"%s"N).0xr r 9/usr/lib64/python3.6/multiprocessing/popen_spawn_win32.py )sz!Popen.__init__..wbT)closefdF)rZget_preparation_data_name_winapiZ CreatePipemsvcrtZopen_osfhandleZget_command_lineosgetpidjoinopenZ CreateProcessZget_executableZ CloseHandlepid returncode_handleintsentinelrZFinalizerrdump) selfZ process_objZ prep_dataZrhandleZwhandleZwfdcmdZto_childZhpZhtrtidr r r__init__ s2      zPopen.__init__cCstj||jS)N)rZ duplicater)rZhandler r rduplicate_for_childEszPopen.duplicate_for_childNcCst|jdkrn|dkrtj}ntdt|dd}tjt|j|}|tjkrntj|j}|t krht j }||_|jS)Nrig?) rrZINFINITEmaxrZWaitForSingleObjectrZ WAIT_OBJECT_0ZGetExitCodeProcess TERMINATEsignalSIGTERM)rtimeoutZmsecsrescoder r rwaitIs   z Popen.waitcCs |jddS)Nr)r()r+)rr r rpollYsz Popen.pollc CsL|jdkrHytjt|jtWn&tk rF|jdddkrBYnXdS)Ng?)r()rrZTerminateProcessrrr%OSErrorr+)rr r r terminate\s  zPopen.terminate)N) __name__ __module__ __qualname____doc__methodr"r#r+r,r.r r r rrs% )rrr&sysrcontextrrrrr__all__r%platformgetattrZWINEXE executablelowerendswithZ WINSERVICEobjectrr r r rs