From c6a74b63224effd9a7d6b2cda87c38e092b35aa5 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Thu, 23 Apr 2020 20:21:41 +0200 Subject: [bug] stop service before uninstalling it - clear errors properly on each stop attempt - fix autostart --- pkg/helper/windows_install.go | 2 +- pkg/helper/windows_service.go | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'pkg') diff --git a/pkg/helper/windows_install.go b/pkg/helper/windows_install.go index 637e80b..d2298b0 100644 --- a/pkg/helper/windows_install.go +++ b/pkg/helper/windows_install.go @@ -56,7 +56,7 @@ func installService(name, desc string) error { s.Close() return fmt.Errorf("service %s already exists", name) } - s, err = m.CreateService(name, exepath, mgr.Config{DisplayName: desc}, "is", "auto-started") + s, err = m.CreateService(name, exepath, mgr.Config{StartType: mgr.StartAutomatic, DisplayName: desc}) if err != nil { return err } diff --git a/pkg/helper/windows_service.go b/pkg/helper/windows_service.go index 3675249..320f743 100644 --- a/pkg/helper/windows_service.go +++ b/pkg/helper/windows_service.go @@ -25,9 +25,7 @@ func (m *myservice) Execute(args []string, r <-chan svc.ChangeRequest, changes c changes <- svc.Status{State: svc.Running, Accepts: cmdsAccepted} // defined in helper.go - // TODO should have a way to stop it -- - //go serveHTTP("localhost:7171") - log.Println("serving>>", httpServerConf.BindAddr) + // TODO should have a better way to stop it -- go serveHTTP(httpServerConf.BindAddr) loop: for { -- cgit v1.2.3