diff --git a/rattail/commands.py b/rattail/commands.py index f8c67ea0c1b71d711591ffd5194a7d49d4c56b04..ef84998df3df7a98ff5ea4b7a80b0ac1abb8d590 100644 --- a/rattail/commands.py +++ b/rattail/commands.py @@ -59,12 +59,13 @@ class FileMonitorCommand(commands.FileMonitorCommand): See :class:`edbob.commands.FileMonitorCommand` for more information. """ - name = 'filemon' - description = "Manage the file monitor service" - - def run(self, args): + def get_win32_module(self): from rattail import filemon - self.manage_service(args, filemon) + return filemon + + def get_win32_service(self): + from rattail.filemon import RattailFileMonitor + return RattailFileMonitor class InitCommand(commands.Subcommand): diff --git a/rattail/filemon.py b/rattail/filemon.py index cd105cef7d306bf6a808b411773d475f92233527..ff073fd53d2092b6a007ae6ea8322a1399f8b361 100644 --- a/rattail/filemon.py +++ b/rattail/filemon.py @@ -26,16 +26,10 @@ ``rattail.filemon`` -- Windows File Monitor """ -import sys -import subprocess +from edbob.filemon.win32 import FileMonitorService -from edbob.filemon import win32_server - -class FileMonitorService(win32_server.FileMonitorService): - """ - Implements the Rattail file monitor Windows service. - """ +class RattailFileMonitor(FileMonitorService): _svc_name_ = "Rattail File Monitor" _svc_display_name_ = "Rattail : File Monitoring Service" @@ -43,18 +37,6 @@ class FileMonitorService(win32_server.FileMonitorService): appname = 'rattail' -def exec_server_command(command): - """ - Executes ``command`` against the file monitor Windows service, i.e. one of: - - * ``'install'`` - * ``'start'`` - * ``'stop'`` - * ``'remove'`` - """ - subprocess.call([sys.executable, __file__, command]) - - if __name__ == '__main__': import win32serviceutil - win32serviceutil.HandleCommandLine(FileMonitorService) + win32serviceutil.HandleCommandLine(RattailFileMonitor)