Wccs*dZddlZejdkr edddlZddlZddlZddlZddlZddl Z ddl Z dZ dZ ejZ ejZejZdde d d ZGd d ZGd dej&ZdS)z)Various Windows specific bits and pieces.NZwin32z win32 only)pipePopenPIPE PipeHandlei F)TT)duplex overlappedbufsizec stjdjtjt t }|r9tj}tjtjz}||}}n&tj}tj}d|}}|tjz}|dr|tjz}|drtj}nd}dx} } tj||tjd||tj tj"} tj$||dtj"tj&|tj"} tj(| d} | j+d| | fS#| tj,| | tj,| xYw)zELike os.pipe() but with overlapped support and using handles not fds.z\\.\pipe\python-pipe-{:d}-{:d}-)ZprefixriNTr)tempfileZmktempZformatosZgetpidZnext _mmap_counter_winapiZPIPE_ACCESS_DUPLEXZ GENERIC_READZ GENERIC_WRITEZPIPE_ACCESS_INBOUNDZFILE_FLAG_FIRST_PIPE_INSTANCEZFILE_FLAG_OVERLAPPEDZCreateNamedPipeZ PIPE_WAITZNMPWAIT_WAIT_FOREVERZNULLZ CreateFileZ OPEN_EXISTINGZConnectNamedPipeZGetOverlappedResult CloseHandle) rrrZaddressZopenmodeZaccessZobsizeZibsizeZflags_and_attribsZh1Zh2Zovs ./usr/lib64/python3.12/asyncio/windows_utils.pyrr soo188 IIKm,.//Gv--%%(=(== '..&&G 555H!}}G000!}}#88NB  $ $ Xw00 vvw;;W\\K   VQ g.C.C w||- % %bT : : t$$2v  >    # # >    # # s CG5G9cseZdZdZdZdZedZdZe jddZ e jfdZd 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. cs||_dSN_handleselfhandle r__init__zPipeHandle.__init__Vs  csx|jd|j}nd}d|jjd|dS)Nzhandle=Zclosedz)r __class____name__rrr__repr__zPipeHandle.__repr__YsG << #/t||//FFF64>>**66V6666rcs|jSrrr rrzPipeHandle.handle`s ||rcsL|j td|jS)NzI/O operation on closed pipe)rZ ValueErrorrrrfilenozPipeHandle.filenods" << ;< <||r)r csV|j||jd|_dSdSrr)rr rrclosezPipeHandle.closeis0 << # K % %DLLL $ #rcsl|j'|d|t||jdSdS)Nz unclosed )Zsource)rZResourceWarningr)rZ_warnrr__del__zPipeHandle.__del__ns@ << # E&d&& E E E JJLLLL $ #rcs|Srrrr __enter__zPipeHandle.__enter__ss rcs(|jdSr)r)rZtZvZtbs r__exit__zPipeHandle.__exit__vs rN)r __module__ __qualname____doc__rrZpropertyrrr r rwarningsZwarnrr!r"r rrrrQs777 $+#6#6     %MM rrcs$eZdZdZdfd ZxZS)rzReplacement for subprocess.Popen using overlapped pipe handles. The stdin, stdout, stderr are None or instances of PipeHandle. Nc s\dx}x}}dx} x} } |tkr:tdd\} } tj| tj }n|}|tkr*td\} } tj| d}n|}|tkr*td\} }tj|d}n|t kr|}n|} tj|f|||d|| t| |_ | t| |_ | t| |_ |tkrt j||tkrt j||tkrt j|dSdS#| | | fD]}|tj|xYw#|tkrt j||tkrt j||tkrt j|wxYw)N)FTT)rr)TFrr)stdinstdoutstderr)rrmsvcrtZopen_osfhandler ZO_RDONLYSTDOUTZsuperrrr'r(r)r r r)rZargsr'r(r)ZkwdsZ stdin_rfdZ stdout_wfdZ stderr_wfdZstdin_whZ stdout_rhZ stderr_rhZstdin_rhZ stdout_whZ stderr_whZhrs rrzPopen.__init__s=/32 2J+///9y D==!%t!L!L Hh--h DIII T>>#'=#A#A Iy..y!>#'=#A#A Iy..y!r,s!// <<7 +l ##  0     ! \7+++++b&&&&&&&X0%0%0%0%0%J  0%0%0%0%r