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 ddl	m
Z
 G dd„ deƒZd	d
„ ZedkrŽe
ejd ƒ ¡  ddlmZ eeejd ƒ dS )zÝ
Main program for the child process run by
L{twisted.test.test_stdio.StandardInputOutputTests.test_lastWriteReceived}
to test that L{os.write} can be reliably used after
L{twisted.internet.stdio.StandardIO} has finished.
é    )Úabsolute_importÚdivisionN)ÚProtocol)Ú
StandardIO)ÚnamedAnyc                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚLastWriteChildc                 C   s   || _ || _d S ©N)ÚreactorÚmagicString)Úselfr	   r
   © r   úC/usr/lib/python3/dist-packages/twisted/test/stdio_test_lastwrite.pyÚ__init__   s    zLastWriteChild.__init__c                 C   s   | j  | j¡ | j  ¡  d S r   )Z	transportÚwriter
   ZloseConnection)r   r   r   r   ÚconnectionMade   s    zLastWriteChild.connectionMadec                 C   s   | j  ¡  d S r   )r	   Ústop)r   Úreasonr   r   r   ÚconnectionLost    s    zLastWriteChild.connectionLostN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r      s   r   c                 C   s$   t | | d¡ƒ}t|ƒ |  ¡  d S )NÚascii)r   Úencoder   Úrun)r	   r
   Úpr   r   r   Úmain%   s    r   Ú__main__é   )r	   é   )Ú__doc__Z
__future__r   r   ÚsysZtwisted.internet.protocolr   Ztwisted.internet.stdior   Ztwisted.python.reflectr   r   r   r   ÚargvÚinstallZtwisted.internetr	   r   r   r   r   Ú<module>   s   