Vc"csddlZddlZddlZddlmZddlmZddlmZGddejZ Gdd ej Z Gd d e ej Z dS) N) protocols) transports)loggercseZdZ dfd ZdZdZdZdZdZdZ e j fd Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZxZS)BaseSubprocessTransportNc sDt| 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)Zsuper__init___closed _protocol_loop_proc_pid _returncode _exit_waiters collectionsZdeque_pending_calls_pipes _finishedr ZPIPE_startcloseZpidZ_extra get_debugZ isinstanceZbytesZstrrZdebugZ create_task_connect_pipes)selfloopprotocolrrr r r r waiterZextrakwargsZprogram __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 CC5cs8|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)NZclosedzpid=z returncode=Zrunningz not startedrzstdin=rrzstdout=stderr=zstdout=zstderr=z<{}>z ) r$__name__rappendrrrZgetpipeZformatZjoin)rinfor r r s r%__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 stN)ZNotImplementedError)rrrr r r r r#s r%rzBaseSubprocessTransport._startTs!!r+c||_dSr,r)rr! r% set_protocolz$BaseSubprocessTransport.set_protocolWs !r+c|jSr,r.r r% get_protocolz$BaseSubprocessTransport.get_protocolZs ~r+cr1r,)rr2r3r% is_closingz"BaseSubprocessTransport.is_closing]s |r+cs|jrdSd|_|jD]}||j|j{|jv|j_|j rtj d| |j dS#t$rYdSwxYwdSdSdS)NTz$Close running child process: kill %r)rrvaluesr(rrrZpollrrrZwarningkillProcessLookupError)rZprotor/r%rzBaseSubprocessTransport.close`s  <  F [''))  E  J       J     !! z##%% MEtLLL  !!!!!%          sB:: CCcsl|js,|d|t||dSdS)Nzunclosed transport )Zsource)rZResourceWarningr)rZ_warnr/r%__del__zBaseSubprocessTransport.__del__{sG|  E000/$ O O O O JJLLLLL  r+cr1r,)rr2r3r%get_pidzBaseSubprocessTransport.get_pids yr+cr1r,)rr2r3r%get_returncodez&BaseSubprocessTransport.get_returncodes r+cs<||jvr|j|jSdSr,)rr()rfdr/r%get_pipe_transportz*BaseSubprocessTransport.get_pipe_transports%   ;r?' '4r+cs0|jtdSr,)rr8r2r3r% _check_procz#BaseSubprocessTransport._check_procs" : '$&& & ' 'r+csb||j|dSr,)r>r send_signal)rZsignalr/r%r?z#BaseSubprocessTransport.send_signals0  v&&&&&r+c`||jdSr,)r>r terminater2r3r%rAz!BaseSubprocessTransport.terminates.  r+cr@r,)r>rr7r2r3r%r7zBaseSubprocessTransport.kills,  r+csK 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)WriteSubprocessPipeProtor2r%8BaseSubprocessTransport._connect_pipes..s4T1==r+rcrB)NrReadSubprocessPipeProtor2rDr%rErF3D!<<r+rcrB)NrrGr2rDr%rErFrIr+r)rrr Zconnect_write_piperr Zconnect_read_piper call_soonrconnection_mader cancelled set_resultZ SystemExitZKeyboardInterruptZ BaseExceptionZ set_exception) rr"procr Z_r(Zcallbackdataexcs ` r%rz&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 csv|j|j||fdS|jj|g|RdSr,)rr'rrJ)rZcbrO r%_callzBaseSubprocessTransport._callsQ   ,   & &Dz 2 2 2 2 2 DJ  +d + + + + + +r+csp||jj|||dSr,)rRrZpipe_connection_lost _try_finish)rr<rPrQr%_pipe_connection_lostz-BaseSubprocessTransport._pipe_connection_losts5 4>6C@@@ r+csH||jj||dSr,)rRrZpipe_data_received)rr<rOrQr%_pipe_data_receivedz+BaseSubprocessTransport._pipe_data_receiveds# 4>4b$?????r+cs||jrtjd||||_|jj ||j_||jj | |j D]+}| s| |,d|_ dS)Nz%r exited with return code %r)rrrr)rr returncoderRrZprocess_exitedrSrrLrM)rrVr"rQr%_process_exitedz'BaseSubprocessTransport._process_exiteds :   ! ! K K7z J J J% :  /%/DJ ! 4>0111 ( . .F##%% .!!*---!r+csK |j|jS|j}|j||d{VSr,)rrZ create_futurerr')rr"r/r%_waitzBaseSubprocessTransport._waits] '   $# #))++ !!&)))||||||r+cs|jdStd|jDr$d|_||jddSdS)Nc3s,K|]}|duo|jVdSr,) disconnected)Z.0Zpr/r%z z6BaseSubprocessTransport._try_finish..sA..}/......r+T)rZallrr6rrR_call_connection_lostr2r3r%rSz#BaseSubprocessTransport._try_finishs|    F .. **,,... . . 9!DN JJt14 8 8 8 8 8 9 9r+cs |j|d|_d|_d|_dS#d|_d|_d|_wxYwr,)rconnection_lostrrrrPr/r%rZz-BaseSubprocessTransport._call_connection_lostsZ " N * *3 / / /DJDJ!DNNNDJDJ!DN ! ! ! !s 3A )NN)r& __module__ __qualname__rr*rr0r4r5rwarningsZwarnr9r:r;r=r>r?rAr7rrRrTrUrWrXrSrZZ __classcell__)r$s@r%rr s%))<)<)<)<)<)||_||_d|_d|_dS)NF)rNr<r(rY)rrNr<rQr%rz!WriteSubprocessPipeProto.__init__s%  !r+cr-r,)r()rZ transportr/r%rKz(WriteSubprocessPipeProto.connection_mades  r+csBd|jjd|jd|jdS)Nz)r$r&r<r(r2r3r%r*z!WriteSubprocessPipeProto.__repr__ s,M4>*MMMMtyMMMMr+csbd|_|j|j|d|_dS)NT)rYrNrTr<r\r/r%r[z(WriteSubprocessPipeProto.connection_lost s/  ''555 r+cB|jjdSr,)rNr pause_writingr2r3r%raz&WriteSubprocessPipeProto.pause_writings ))+++++r+cr`r,)rNrresume_writingr2r3r%rbz'WriteSubprocessPipeProto.resume_writings **,,,,,r+N) r&r]r^rrKr*r[rarbrr+r%rCrCsq""" NNN ,,,-----r+rCcseZdZdZdS)rHcsF|j|j|dSr,)rNrUr<)rrOr/r% data_receivedz%ReadSubprocessPipeProto.data_receiveds" %%dgt44444r+N)r&r]r^rcrr+r%rHrHs#55555r+rH)rr r_ZrrZlogrZSubprocessTransportrZ BaseProtocolrCZProtocolrHrr+r%rdsr"r"r"r"r"j<r"r"r"j-----y5---4555556'055555r+