VcdZddlZejdkr edddlZddlZddlZddlZddlZddl Z ddl Z dZ dZ ej Z ejZejZdde d d ZGd d ZGd dejZdS)z)Various Windows specific bits and pieces.Nwin32z win32 only)pipePopenPIPE PipeHandlei F)TT)duplex overlappedbufsizec Rtjdtjt t }|r*tj}tj tj z}||}}ntj }tj }d|}}|tj z}|dr|tj z}|dr tj }nd}dx} } tj||tjd||tjtj} tj||dtjtj|tj} tj| d} | d| | fS#| tj| | tj| xYw)zELike os.pipe() but with overlapped support and using handles not fds.z\\.\pipe\python-pipe-{:d}-{:d}-)prefixrNTr )tempfilemktempformatosgetpidnext _mmap_counter_winapiPIPE_ACCESS_DUPLEX GENERIC_READ GENERIC_WRITEPIPE_ACCESS_INBOUNDFILE_FLAG_FIRST_PIPE_INSTANCEFILE_FLAG_OVERLAPPEDCreateNamedPipe PIPE_WAITNMPWAIT_WAIT_FOREVERNULL CreateFile OPEN_EXISTINGConnectNamedPipeGetOverlappedResult CloseHandle) rr r addressopenmodeaccessobsizeibsizeflags_and_attribsh1h2ovs ./usr/lib64/python3.11/asyncio/windows_utils.pyrr so188 IKKm,,..///G$-%(== '.&G 55H!}1G00!}#8NB  $ Xw0 vvw;W\KK  VQ g.C w|-- %bT : : : t$$$2v   $   # # #  $   # # # s BE77/F&cpeZdZdZdZdZedZdZe j ddZ e j fdZd Zd Zd S) rzWrapper for an overlapped pipe handle which is vaguely file-object like. The IOCP event loop can use these instead of socket objects. c||_dSN_handleselfhandles r/__init__zPipeHandle.__init__Vs  cP|j d|j}nd}d|jjd|dS)Nzhandle=closed< >)r4 __class____name__r5s r/__repr__zPipeHandle.__repr__Ys@ < /t|//FFF64>*66V6666r9c|jSr2r3r6s r/r7zPipeHandle.handle`s |r9c<|jtd|jS)NzI/O operation on closed pipe)r4 ValueErrorrCs r/filenozPipeHandle.filenods# < =;<< <|r9)r%cF|j||jd|_dSdSr2r3)r6r%s r/closezPipeHandle.closeis3 < K % % %DLLL  r9cl|j,|d|t||dSdS)Nz unclosed )source)r4ResourceWarningrH)r6_warns r/__del__zPipeHandle.__del__nsG <  E&d&& E E E E JJLLLLL  r9c|Sr2rCs r/ __enter__zPipeHandle.__enter__ss r9c.|dSr2)rH)r6tvtbs r/__exit__zPipeHandle.__exit__vs r9N)r@ __module__ __qualname____doc__r8rApropertyr7rFrr%rHwarningswarnrMrPrUrOr9r/rrQs777X $+#6     %M r9rc$eZdZdZdfd ZxZS)rzReplacement for subprocess.Popen using overlapped pipe handles. The stdin, stdout, stderr are None or instances of PipeHandle. Nc |drJ|dddksJdx}x}}dx} x} } |tkr4tdd\} } tj| t j}n|}|tkr)td\} } tj| d}n|}|tkr)td\} }tj|d}n|tkr|}n|} tj |f|||d || t| |_ | t| |_ | t| |_ n$#| | | fD]}|tj|xYw|tkrt j||tkrt j||tkrt j|dSdS#|tkrt j||tkrt j||tkrt j|wwxYw) Nuniversal_newlinesr r)FTT)r r)TFr)stdinstdoutstderr)getrrmsvcrtopen_osfhandlerO_RDONLYSTDOUTsuperr8rr_r`rarr%rH)r6argsr_r`rakwds stdin_rfd stdout_wfd stderr_wfdstdin_wh stdout_rh stderr_rhstdin_rh stdout_wh stderr_whhr?s r/r8zPopen.__init__s88011111xx 1%%****.22 2J+///9y D= !%t!L!L!L Hh-h DDIII T> #'=#A#A#A Iy.y!< #'=#A#A#A Iy.y!<r}s'// <7$ +l # ##  0    !! \7+++++b&&&&&&&&X0%0%0%0%0%J 0%0%0%0%0%r9