U
    ¹êW[  ã                   @   sÀ   d Z ddlmZmZ ddlZddlmZ ddlmZ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.
é    )Úabsolute_importÚdivisionN)ÚConnectionDone)ÚstdioÚprotocol)ÚreflectÚlogc                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚLoseConnChildr   c                 C   s   | j  ¡  d S )N)Z	transportZloseConnection)Úself© r   úB/usr/lib/python3/dist-packages/twisted/test/stdio_test_loseconn.pyÚconnectionMade   s    zLoseConnChild.connectionMadec                 C   sB   z2z| t¡ W n   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   r   Ú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__Z
__future__r   r   ÚsysZtwisted.internet.errorr   Ztwisted.internetr   r   Ztwisted.pythonr   r   ZProtocolr	   r   ZnamedAnyÚargvÚinstallZstartLoggingÚopenr   Z
StandardIOÚrunÚexitr   r   r   r   r   Ú<module>   s   
