windows: add support for automatic delayed start in windows service

Change-Id: Iad33ea0f6627ac98c89dbaab0b41b3dd724c3163
GitHub-Last-Rev: 8764fdbd3200eb38d482cfffb5bd98f565f4395f
GitHub-Pull-Request: golang/sys#36
Reviewed-on: https://go-review.googlesource.com/c/sys/+/187198
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
utkarsh-extc
2019-08-04 05:38:45 +00:00
committed by Alex Brainman
parent cbf593c0f2
commit 51ab0e2dea
4 changed files with 51 additions and 0 deletions
+12
View File
@@ -80,6 +80,9 @@ func testConfig(t *testing.T, s *mgr.Service, should mgr.Config) mgr.Config {
if err != nil {
t.Fatalf("Config failed: %s", err)
}
if should.DelayedAutoStart != is.DelayedAutoStart {
t.Fatalf("config mismatch: DelayedAutoStart is %v, but should have %v", is.DelayedAutoStart, should.DelayedAutoStart)
}
if should.DisplayName != is.DisplayName {
t.Fatalf("config mismatch: DisplayName is %q, but should have %q", is.DisplayName, should.DisplayName)
}
@@ -257,6 +260,15 @@ func TestMyService(t *testing.T) {
testConfig(t, s, c)
c.StartType = mgr.StartAutomatic
c.DelayedAutoStart = true
err = s.UpdateConfig(c)
if err != nil {
t.Fatalf("UpdateConfig failed: %v", err)
}
testConfig(t, s, c)
svcnames, err := m.ListServices()
if err != nil {
t.Fatalf("ListServices failed: %v", err)