U
    Â“«j/  ã                   @   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r¬e	 ejd	 ¡ ¡  e eejd
 dƒ¡ ddlmZ eƒ Ze e¡ e ¡  e ej¡ 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)Ú	transportZloseConnection)Úself© r
   úD/tmp/pip-unpacked-wheel-59kc99xd/twisted/test/stdio_test_loseconn.pyÚconnectionMade   s    zLoseConnChild.connectionMadec                 C   sJ   z:z| t¡ W n& tk
r6   t dd¡ d| _Y nX W 5 t  ¡  X dS )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é   )ÚreactorÚstopZtrapr   ÚBaseExceptionr   ÚerrÚexitCode)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__ÚsysZtwisted.internetr   r   Ztwisted.internet.errorr   Ztwisted.pythonr   r   ÚProtocolr   r   ZnamedAnyÚargvÚinstallZstartLoggingÚopenr   ZprotocolLoseConnChildZ
StandardIOÚrunÚexitr   r
   r
   r
   r   Ú<module>   s   
