Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/twisted/conch/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/twisted/conch/__pycache__/stdio.cpython-37.pyc

B

:��]�
�@s�dZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
mZmZm
Z
ddlmZddlmZGdd�de�ZGd	d
�d
ej�ZGdd�de�Zd
d�Zddd�Zedkr�e�dS)zC
Asynchronous local terminal input handling

@author: Jp Calderone
�N)�reactor�stdio�protocol�defer)�failure�reflect�log)�ServerProtocol)�ColoredManholec@seZdZdS)�UnexpectedOutputErrorN)�__name__�
__module__�__qualname__�rr�F/opt/alt/python37/lib64/python3.7/site-packages/twisted/conch/stdio.pyrsrc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�TerminalProcessProtocolcCs||_t��|_dS)N)�protorZDeferred�onConnection)�selfrrrr�__init__sz TerminalProcessProtocol.__init__cCs"|j�|�|j�d�d|_dS)N)rZmakeConnectionr�callback)rrrr�connectionMadesz&TerminalProcessProtocol.connectionMadecCs|j�|�dS)zj
        Write to the terminal.

        @param data: Data to write.
        @type data: L{bytes}
        N)�	transport�write)r�datarrrr$szTerminalProcessProtocol.writecCs|j�|�dS)zs
        Receive data from the terminal.

        @param data: Data received.
        @type data: L{bytes}
        N)rZdataReceived)rrrrr�outReceived.sz#TerminalProcessProtocol.outReceivedcCs4|j��|jdk	r0|j�t�t|���d|_dS)zt
        Report an error.

        @param data: Data to include in L{Failure}.
        @type data: L{bytes}
        N)rZloseConnectionr�connectionLostrZFailurer)rrrrr�errReceived8s

z#TerminalProcessProtocol.errReceivedcCs|jdk	r|j�|�dS)N)r�childConnectionLost)rZchildFDrrrrEs
z+TerminalProcessProtocol.childConnectionLostcCs |jdk	r|j�|�d|_dS)N)rr)r�reasonrrr�processEndedJs
z$TerminalProcessProtocol.processEndedN)
rr
rrrrrrrr rrrrrs


rc@seZdZdZdd�ZdS)�ConsoleManholezK
    A manhole protocol specifically for use with L{stdio.StandardIO}.
    cCst��dS)z�
        When the connection is lost, there is nothing more to do.  Stop the
        reactor so that the process can exit.
        N)r�stop)rrrrrrUszConsoleManhole.connectionLostN)rr
r�__doc__rrrrrr!Qsr!cCs\tj��}t�|�}t�|�zt�t	|��t
��Wdt�|tj
|�t�|d�XdS)Ns
c
)�sys�	__stdin__�fileno�termiosZ	tcgetattr�ttyZsetrawrZ
StandardIOr	r�runZ	tcsetattrZTCSANOW�osr)�klass�fdZoldSettingsrrr�runWithProtocol^s


r-cCsJt�tdd��|dkr&tjdd�}|r:t�|d�}nt}t|�dS)Nz	child.log�w�r)	rZstartLogging�openr$�argvrZ
namedClassr!r-)r1r+rrr�mainksr2�__main__)N)r#r*r(r$r'Ztwisted.internetrrrrZtwisted.pythonrrrZtwisted.conch.insults.insultsr	Ztwisted.conch.manholer
�	ExceptionrZProcessProtocolrr!r-r2rrrrr�<module>	s 9