o
    ¯b  ã                   @   sd   d dl Z d dlZd dlmZ d dlmZmZmZ d dlm	Z	 G dd„ dej
ƒZ
G dd„ dejƒZdS )	é    N)Ú	copyright)ÚappÚinternetÚservice)Úlogc                   @   s"   e Zd ZdZg d¢gZdd„ ZdS )ÚServerOptionszUsage: twistd [options])ÚnodaemonÚnz(for backwards compatibility).c                 C   s2   t dtj› �| jd� t tj| jd� t ¡  dS )z5
        Print version information and exit.
        z$twistd (the Twisted Windows runner) )ÚfileN)Úprintr   ÚversionÚstdoutÚsysÚexit©Úself© r   ú9/usr/lib/python3/dist-packages/twisted/scripts/_twistw.pyÚopt_version   s   
þzServerOptions.opt_versionN)Ú__name__Ú
__module__Ú__qualname__ÚsynopsisÚoptFlagsr   r   r   r   r   r      s
    ÿr   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚWindowsApplicationRunnerzn
    An ApplicationRunner which avoids unix-specific things. No
    forking, no PID files, no privileges.
    c                 C   s$   t j| _t j| _t | jd ¡ dS )z4
        Do pre-application-creation setup.
        ÚrundirN)r   r   Ú	oldstdoutÚstderrÚ	oldstderrÚosÚchdirÚconfigr   r   r   r   ÚpreApplication'   s   z'WindowsApplicationRunner.preApplicationc                 C   s^   t  | j¡ ¡  t | j| jd  ¡ t t ddd„ ¡d¡ |  	d| j
| j¡ t d¡ dS )z<
        Start the application and run the reactor.
        Úno_savegš™™™™™¹?c                   S   s   d S )Nr   r   r   r   r   Ú<lambda>5   s    z:WindowsApplicationRunner.postApplication.<locals>.<lambda>r   NzServer Shut Down.)r   ÚIServiceÚapplicationÚprivilegedStartServicer   ÚstartApplicationr!   r   ÚTimerServiceÚstartReactorr   r   r   Úmsgr   r   r   r   ÚpostApplication/   s
   z(WindowsApplicationRunner.postApplicationN)r   r   r   Ú__doc__r"   r,   r   r   r   r   r   !   s    r   )r   r   Útwistedr   Útwisted.applicationr   r   r   Útwisted.pythonr   r   ÚApplicationRunnerr   r   r   r   r   Ú<module>   s   