o
    ¯b/  ã                   @   s´   d Z ddlZddlmZmZ ddlmZ ddlmZm	Z	 G dd„ dej
ƒZedkrXe	 ejd	 ¡ ¡  e eejd
 dƒ¡ ddlmZ eƒ Ze e¡ e ¡  e ej¡ dS dS )zº
Main program for the child process run by
L{twisted.test.test_stdio.StandardInputOutputTests.test_loseConnection} to
test that ITransport.loseConnection() works for process transports.
é    N)ÚprotocolÚstdio)ÚConnectionDone)ÚlogÚreflectc                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚLoseConnChildr   c                 C   s   | j  ¡  d S )N)Ú	transportÚloseConnection)Úself© r   úB/usr/lib/python3/dist-packages/twisted/test/stdio_test_loseconn.pyÚconnectionMade   s   zLoseConnChild.connectionMadec                 C   s\   z(z|  t¡ W n ty   t dd¡ d| _Y nw W t ¡  dS W t ¡  dS t ¡  w )a  
        Check that C{reason} is a L{Failure} wrapping a L{ConnectionDone}
        instance and stop the reactor.  If C{reason} is wrong for some reason,
        log something about that in C{self.errorLogFile} and make sure the
        process exits with a non-zero status.
        Nz,Problem with reason passed to connectionLosté   )Útrapr   ÚBaseExceptionr   ÚerrÚexitCodeÚreactorÚstop)r
   Úreasonr   r   r   ÚconnectionLost   s   
þÿþzLoseConnChild.connectionLostN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r      s    r   Ú__main__r   é   Úwb)r   )Ú__doc__ÚsysÚtwisted.internetr   r   Útwisted.internet.errorr   Útwisted.pythonr   r   ÚProtocolr   r   ÚnamedAnyÚargvÚinstallÚstartLoggingÚopenr   ÚprotocolLoseConnChildÚ
StandardIOÚrunÚexitr   r   r   r   r   Ú<module>   s   
ø