+
    Dfj
                         R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
HtHtHt ^ RIHtHtHt  ! R R]4      t ! R R	]P(                  4      t ! R
 R]4      tR tRR lt]R8X  d
   ]! 4        R# R# )zC
Asynchronous local terminal input handling

@author: Jp Calderone
N)ServerProtocol)ColoredManhole)deferprotocolreactorstdio)failurelogreflectc                       ] tR t^tRtR# )UnexpectedOutputError N)__name__
__module____qualname____firstlineno____static_attributes__r       5/usr/lib/python3/dist-packages/twisted/conch/stdio.pyr   r      s    r   r   c                   J   a  ] tR t^t o R tR tR tR tR tR t	R t
RtV tR	# )
TerminalProcessProtocolc                F    Wn         \        P                  ! 4       V n        R # N)protor   DeferredonConnection)selfr   s   &&r   __init__ TerminalProcessProtocol.__init__   s    
!NN,r   c                    V P                   P                  V 4       V P                  P                  R 4       R V n        R # r   )r   makeConnectionr   callback)r   s   &r   connectionMade&TerminalProcessProtocol.connectionMade   s0    

!!$'""4( r   c                <    V P                   P                  V4       R# )zJ
Write to the terminal.

@param data: Data to write.
@type data: L{bytes}
N)	transportwriter   datas   &&r   r&   TerminalProcessProtocol.write$   s     	T"r   c                <    V P                   P                  V4       R# )zS
Receive data from the terminal.

@param data: Data received.
@type data: L{bytes}
N)r   dataReceivedr'   s   &&r   outReceived#TerminalProcessProtocol.outReceived-   s     	

%r   c                    V P                   P                  4        V P                  eB   V P                  P                  \        P
                  ! \        V4      4      4       RV n        R# R# )zT
Report an error.

@param data: Data to include in L{Failure}.
@type data: L{bytes}
N)r%   loseConnectionr   connectionLostr   Failurer   r'   s   &&r   errReceived#TerminalProcessProtocol.errReceived6   sK     	%%'::!JJ%%goo6KD6Q&RSDJ "r   c                \    V P                   e   V P                   P                  V4       R # R # r   )r   childConnectionLost)r   childFDs   &&r   r5   +TerminalProcessProtocol.childConnectionLostB   s#    ::!JJ**73 "r   c                j    V P                   e%   V P                   P                  V4       R V n         R # R # r   )r   r0   r   reasons   &&r   processEnded$TerminalProcessProtocol.processEndedF   s*    ::!JJ%%f-DJ "r   )r   r   N)r   r   r   r   r   r"   r&   r,   r2   r5   r;   r   __classdictcell____classdict__s   @r   r   r      s-     -!
#&
4 r   r   c                   *   a  ] tR t^Lt o RtR tRtV tR# )ConsoleManholezC
A manhole protocol specifically for use with L{stdio.StandardIO}.
c                0    \         P                  ! 4        R# )zk
When the connection is lost, there is nothing more to do.  Stop the
reactor so that the process can exit.
N)r   stopr9   s   &&r   r0   ConsoleManhole.connectionLostQ   s    
 	r   r   N)r   r   r   r   __doc__r0   r   r=   r>   s   @r   rA   rA   L   s      r   rA   c                    \         P                  P                  4       p\        P                  ! V4      p\
        P                  ! V4        \        P                  ! \        V 4      4       \        P                  ! 4        \        P                  ! V\        P                  V4       \        P                  ! VR 4       R#   \        P                  ! T\        P                  T4       \        P                  ! TR 4       i ; i)s   cN)sys	__stdin__filenotermios	tcgetattrttysetrawr   
StandardIOr   r   run	tcsetattrTCSANOWosr&   )klassfdoldSettingss   &  r   runWithProtocolrV   Y   s    				B##B'KJJrN#./"goo{;
\" 	"goo{;
\"s   4B? ??C>c                     \         P                  ! \        R R4      4       V f   \        P                  R,          p V '       d   \
        P                  ! V ^ ,          4      pM\        p\        V4       R# )z	child.logwN:   NN)	r	   startLoggingopenrG   argvr
   
namedClassrA   rV   )r\   rS   s   & r   mainr^   e   sM    T+s+,|xx|""47+Er   __main__r   )rE   rR   rG   rJ   rL   twisted.conch.insults.insultsr   twisted.conch.manholer   twisted.internetr   r   r   r   twisted.pythonr   r	   r
   	Exceptionr   ProcessProtocolr   rA   rV   r^   r   r   r   r   <module>rf      ss   
 
 
  
 8 0 < < 0 0	I 	/h66 /d
^ 
	#	 zF r   