diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-04-23 20:21:41 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-04-30 22:10:30 +0200 |
commit | c6a74b63224effd9a7d6b2cda87c38e092b35aa5 (patch) | |
tree | f10e586ee9e9fbd1db5138aa88951f97dd8aac72 /pkg | |
parent | a62bd8d0ff93c224ffed086c8e50174e08a6b45c (diff) |
[bug] stop service before uninstalling it
- clear errors properly on each stop attempt
- fix autostart
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/helper/windows_install.go | 2 | ||||
-rw-r--r-- | pkg/helper/windows_service.go | 4 |
2 files changed, 2 insertions, 4 deletions
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 { |