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   