ó
ûý‘Mc           @   s   d  d l  Z  d  d l Z d  d l Z d Z d Z d  d l Z e j j d ƒ Z d „  Z	 d e  j
 f d „  ƒ  YZ e d k rŒ e  j e ƒ n  d S(	   iÿÿÿÿNsN   D:\Python26\python.exe "D:\Python26\Scripts\twistd.py" --python mointwisted.pys   E:\Moin\moins   kernel32.dllc         C   s;   t  j d t |  ƒ } | r. t  j | d ƒ n	 d |  GHd  S(   Ni   i    s   can't open process %s(   t   kernel32t   OpenProcesst   Falset   TerminateProcess(   t   pidt   handle(    (    si   /home/eqsource/webapps/sivwiki/underlay/pages/HelpOnInstalling(2f)TwistedWeb/attachments/servicerunner.pyt   kill_process   s    t   servicerunnerc           B   s/   e  Z d  Z d  Z d „  Z d „  Z d „  Z RS(   t   mointwistedc         C   s    t  j j |  | ƒ t |  _ d  S(   N(   t   win32serviceutilt   ServiceFrameworkt   __init__R   t   service_want_to_stop(   t   selft   args(    (    si   /home/eqsource/webapps/sivwiki/underlay/pages/HelpOnInstalling(2f)TwistedWeb/attachments/servicerunner.pyR      s    c         C   s-   |  j  t j ƒ t |  _ t |  j j ƒ d  S(   N(   t   ReportServiceStatust   win32servicet   SERVICE_STOP_PENDINGt   TrueR   R   t   pR   (   R   (    (    si   /home/eqsource/webapps/sivwiki/underlay/pages/HelpOnInstalling(2f)TwistedWeb/attachments/servicerunner.pyt   SvcStop$   s    	c         C   sH   t  |  _ x8 |  j t  k rC t j t d t ƒ|  _ |  j j ƒ  q Wd  S(   Nt   cwd(   R   R   t
   subprocesst   PopenR   t   mointwisted_dirR   t   wait(   R   (    (    si   /home/eqsource/webapps/sivwiki/underlay/pages/HelpOnInstalling(2f)TwistedWeb/attachments/servicerunner.pyt   SvcDoRun1   s    	(   t   __name__t
   __module__t
   _svc_name_t   _svc_display_name_R   R   R   (    (    (    si   /home/eqsource/webapps/sivwiki/underlay/pages/HelpOnInstalling(2f)TwistedWeb/attachments/servicerunner.pyR      s
   		t   __main__(   R	   R   R   R   R   t   ctypest   windllt   LoadLibraryR    R   R
   R   R   t   HandleCommandLine(    (    (    si   /home/eqsource/webapps/sivwiki/underlay/pages/HelpOnInstalling(2f)TwistedWeb/attachments/servicerunner.pyt   <module>   s   	 