mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-06 00:57:18 -04:00
windows/svc/mgr: add Mgr.ListServices
Add API to list services installed on the system. Fixes golang/go#20596 Change-Id: Ifa2f20ef15ccb962bd21d03788ce931dd45f2630 Reviewed-on: https://go-review.googlesource.com/45711 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
@@ -150,5 +150,20 @@ func TestMyService(t *testing.T) {
|
||||
|
||||
testConfig(t, s, c)
|
||||
|
||||
svcnames, err := m.ListServices()
|
||||
if err != nil {
|
||||
t.Fatalf("ListServices failed: %v", err)
|
||||
}
|
||||
var myserviceIsInstalled bool
|
||||
for _, sn := range svcnames {
|
||||
if sn == name {
|
||||
myserviceIsInstalled = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !myserviceIsInstalled {
|
||||
t.Errorf("ListServices failed to find %q service", name)
|
||||
}
|
||||
|
||||
remove(t, s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user