ó
[³XMc           @   sñ   d  Z  d d l Z d d l m Z d d l m Z m Z d d l m Z m	 Z	 d e j
 f d „  ƒ  YZ e d k rí e j e j d	 ƒ j ƒ  e	 j e e j d
 d ƒ ƒ d d l m Z e ƒ  Z e j e ƒ e j ƒ  e j e j ƒ n  d S(   s½   
Main program for the child process run by
L{twisted.test.test_stdio.StandardInputOutputTestCase.test_loseConnection} to
test that ITransport.loseConnection() works for process transports.
iÿÿÿÿN(   t   ConnectionDone(   t   stdiot   protocol(   t   reflectt   logt   LoseConnChildc           B   s    e  Z d  Z d „  Z d „  Z RS(   i    c         C   s   |  j  j ƒ  d  S(   N(   t	   transportt   loseConnection(   t   self(    (    sD   /usr/lib/python2.7/dist-packages/twisted/test/stdio_test_loseconn.pyt   connectionMade   s    c         C   sJ   z8 y | j  t ƒ Wn  t j d d ƒ d |  _ n XWd t j ƒ  Xd S(   s  
        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.
        s,   Problem with reason passed to connectionLosti   N(   t   trapR    R   t   errt   Nonet   exitCodet   reactort   stop(   R   t   reason(    (    sD   /usr/lib/python2.7/dist-packages/twisted/test/stdio_test_loseconn.pyt   connectionLost   s    (   t   __name__t
   __module__R   R	   R   (    (    (    sD   /usr/lib/python2.7/dist-packages/twisted/test/stdio_test_loseconn.pyR      s   	t   __main__i   i   t   w(   R   (   t   __doc__t   syst   twisted.internet.errorR    t   twisted.internetR   R   t   twisted.pythonR   R   t   ProtocolR   R   t   namedAnyt   argvt   installt   startLoggingt   fileR   t
   StandardIOt   runt   exitR   (    (    (    sD   /usr/lib/python2.7/dist-packages/twisted/test/stdio_test_loseconn.pyt   <module>	   s   	
