mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-06 09:07:16 -04:00
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:
committed by
Alex Brainman
parent
cbf593c0f2
commit
51ab0e2dea
@@ -149,6 +149,14 @@ func (m *Mgr) CreateService(name, exepath string, c Config, args ...string) (*Se
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if c.DelayedAutoStart {
|
||||
err = updateStartUp(h, c.DelayedAutoStart)
|
||||
if err != nil {
|
||||
windows.DeleteService(h)
|
||||
windows.CloseHandle(h)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return &Service{Name: name, Handle: h}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user