Vc"ddlZddlZddlZddlmZddlmZddlmZGddejZ Gdd ej Z Gd d e ej Z dS) N) protocols) transports)loggerceZdZ dfd ZdZdZdZdZdZdZ e j fd Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZxZS)BaseSubprocessTransportNc Dt| d|_||_||_d|_d|_d|_g|_tj |_ i|_ d|_ |tjkr d|j d<|tjkr d|j d<|tjkr d|j d< |jd||||||d| n#|xYw|jj|_|j|jd<|jrBt+|t,t.fr|} n|d} t1jd| |j|j|| dS) NFrr)argsshellstdinstdoutstderrbufsize subprocesszprocess %r created: pid %s)super__init___closed _protocol_loop_proc_pid _returncode _exit_waiters collectionsdeque_pending_calls_pipes _finishedrPIPE_startclosepid_extra get_debug isinstancebytesstrrdebug create_task_connect_pipes)selfloopprotocolr r r rrrwaiterextrakwargsprogram __class__s 0/usr/lib64/python3.11/asyncio/base_subprocess.pyrz BaseSubprocessTransport.__init__ s  !   )/11  JO # "!DKN Z_ $ "!DKN Z_ $ "!DKN  DK BTeF%w B B:@ B B B B  JJLLL JN $(J L! :   ! ! -$ -- "q' L5 $) - - - t226::;;;;;s CC5c8|jjg}|jr|d|j|d|j|j|d|jn2|j|dn|d|jd}||d|j|jd}|jd }|"||ur|d |jn>||d |j||d |jd d |S)Nclosedzpid=z returncode=runningz not startedrzstdin=rr zstdout=stderr=zstdout=zstderr=z<{}> ) r4__name__rappendrrrgetpipeformatjoin)r-infor rrs r5__repr__z BaseSubprocessTransport.__repr__7s'( < " KK ! ! ! 9 , KK*ty** + + +   ' KK8d&688 9 9 9 9 Y ' KK " " " " KK & & & ""  / KK--- . . .####  5&F"2 5 KK666 7 7 7 7 5 3fk33444 5 3fk33444}}SXXd^^,,,c tN)NotImplementedError)r-r r r rrrr2s r5r"zBaseSubprocessTransport._startTs!!rBc||_dSrDr)r-r/s r5 set_protocolz$BaseSubprocessTransport.set_protocolWs !rBc|jSrDrGr-s r5 get_protocolz$BaseSubprocessTransport.get_protocolZs ~rBc|jSrD)rrJs r5 is_closingz"BaseSubprocessTransport.is_closing]s |rBc|jrdSd|_|jD]}||j|j{|jv|j_|j rtj d| |j dS#t$rYdSwxYwdSdSdS)NTz$Close running child process: kill %r)rrvaluesr=r#rrpollrr&rwarningkillProcessLookupError)r-protos r5r#zBaseSubprocessTransport.close`s  <  F [''))  E  J       J     !! z##%% MEtLLL  !!!!!%          sB:: CCcl|js,|d|t||dSdS)Nzunclosed transport )source)rResourceWarningr#)r-_warns r5__del__zBaseSubprocessTransport.__del__{sG|  E000/$ O O O O JJLLLLL  rBc|jSrD)rrJs r5get_pidzBaseSubprocessTransport.get_pids yrBc|jSrD)rrJs r5get_returncodez&BaseSubprocessTransport.get_returncodes rBc<||jvr|j|jSdSrD)rr=)r-fds r5get_pipe_transportz*BaseSubprocessTransport.get_pipe_transports%   ;r?' '4rBc0|jtdSrD)rrSrJs r5 _check_procz#BaseSubprocessTransport._check_procs" : '$&& & ' 'rBcb||j|dSrD)rbr send_signal)r-signals r5rdz#BaseSubprocessTransport.send_signals0  v&&&&&rBc`||jdSrD)rbr terminaterJs r5rgz!BaseSubprocessTransport.terminates.  rBc`||jdSrD)rbrrRrJs r5rRzBaseSubprocessTransport.kills,  rBcK j}j}|j1|fd|jd{V\}}|jd<|j1|fd|jd{V\}}|jd<|j1|fd|jd{V\}}|jd<|j j j D]\}}|j|g|Rd_ |+| s| ddSdSdS#ttf$rt $rB}|/| s!||Yd}~dSYd}~dSYd}~dSd}~wwxYw)Nc$tdS)Nr)WriteSubprocessPipeProtorJsr5z8BaseSubprocessTransport._connect_pipes..s4T1==rBrc$tdS)NrReadSubprocessPipeProtorJsr5rlz8BaseSubprocessTransport._connect_pipes..3D!<<rBrc$tdS)Nr rnrJsr5rlz8BaseSubprocessTransport._connect_pipes..rprBr )rrr connect_write_piperrconnect_read_piper call_soonrconnection_mader cancelled set_result SystemExitKeyboardInterrupt BaseException set_exception) r-r0procr._r=callbackdataexcs ` r5r,z&BaseSubprocessTransport._connect_pipess# (:D:Dz & $ 7 7====J! !       4"& A{ & $ 6 6<<<<K!!!!!!!!!!4"& A{ & $ 6 6<<<<K!!!!!!!!!!4"& A NN4>94 @ @ @"&"5 0 0$x/$/////"&D  (&*:*:*<*< (!!$''''' ( ( ( ( -.     * * * *&*:*:*<*< *$$S))))))))) * * * * * * * * * * * * *sC8D..F  +FF cv|j|j||fdS|jj|g|RdSrD)rr;rrt)r-cbrs r5_callzBaseSubprocessTransport._callsQ   ,   & &Dz 2 2 2 2 2 DJ  +d + + + + + +rBcp||jj|||dSrD)rrpipe_connection_lost _try_finish)r-r_rs r5_pipe_connection_lostz-BaseSubprocessTransport._pipe_connection_losts5 4>6C@@@ rBcH||jj||dSrD)rrpipe_data_received)r-r_rs r5_pipe_data_receivedz+BaseSubprocessTransport._pipe_data_receiveds# 4>4b$?????rBc||jrtjd||||_|jj ||j_||jj | |j D]+}| s| |,d|_ dS)Nz%r exited with return code %r)rr&rr@rr returncoderrprocess_exitedrrrvrw)r-rr0s r5_process_exitedz'BaseSubprocessTransport._process_exiteds :   ! ! K K7z J J J% :  /%/DJ ! 4>0111 ( . .F##%% .!!*---!rBcK |j|jS|j}|j||d{VSrD)rr create_futurerr;)r-r0s r5_waitzBaseSubprocessTransport._waits] '   $# #))++ !!&)))||||||rBc|jdStd|jDr$d|_||jddSdS)Nc3,K|]}|duo|jVdSrD) disconnected).0ps r5 z6BaseSubprocessTransport._try_finish..sA..}/......rBT)rallrrOr r_call_connection_lostrJs r5rz#BaseSubprocessTransport._try_finishs|    F .. **,,... . . 9!DN JJt14 8 8 8 8 8 9 9rBc |j|d|_d|_d|_dS#d|_d|_d|_wxYwrD)rconnection_lostrrr-rs r5rz-BaseSubprocessTransport._call_connection_lostsZ " N * *3 / / /DJDJ!DNNNDJDJ!DN ! ! ! !s 3A )NN)r: __module__ __qualname__rrAr"rHrKrMr#warningswarnrYr[r]r`rbrdrgrRr,rrrrrrr __classcell__)r4s@r5rr s%))<)<)<)<)<)||_||_d|_d|_dS)NF)r|r_r=r)r-r|r_s r5rz!WriteSubprocessPipeProto.__init__s%  !rBc||_dSrD)r=)r- transports r5ruz(WriteSubprocessPipeProto.connection_mades  rBcBd|jjd|jd|jdS)N)r4r:r_r=rJs r5rAz!WriteSubprocessPipeProto.__repr__ s,M4>*MMMMtyMMMMrBcbd|_|j|j|d|_dS)NT)rr|rr_rs r5rz(WriteSubprocessPipeProto.connection_lost s/  ''555 rBcB|jjdSrD)r|r pause_writingrJs r5rz&WriteSubprocessPipeProto.pause_writings ))+++++rBcB|jjdSrD)r|rresume_writingrJs r5rz'WriteSubprocessPipeProto.resume_writings **,,,,,rBN) r:rrrrurArrrrrBr5rkrksq""" NNN ,,,-----rBrkceZdZdZdS)rocF|j|j|dSrD)r|rr_)r-rs r5 data_receivedz%ReadSubprocessPipeProto.data_receiveds" %%dgt44444rBN)r:rrrrrBr5roros#55555rBro)rrrrrlogrSubprocessTransportr BaseProtocolrkProtocolrorrBr5rsr"r"r"r"r"j<r"r"r"j-----y5---4555556'055555rB