Drop back to use IsAnInteractiveSession for SVC (#15749)
* Drop back to use IsAnInteractiveSession for SVC There is an apparent permission change problem when using IsWindowsService to determine if the SVC manager should be used. This PR simply drops back to using IsAnInteractiveSession as this does not change behaviour. Fix #15454 Signed-off-by: Andrew Thornton <art27@cantab.net> * Yes staticcheck I know this is deprecated Signed-off-by: Andrew Thornton <art27@cantab.net> * Just leave me alone lint Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
640066840e
commit
bdc1697729
2 changed files with 8 additions and 2 deletions
|
@ -110,3 +110,7 @@ issues:
|
||||||
- text: "exitAfterDefer:"
|
- text: "exitAfterDefer:"
|
||||||
linters:
|
linters:
|
||||||
- gocritic
|
- gocritic
|
||||||
|
- path: modules/graceful/manager_windows.go
|
||||||
|
linters:
|
||||||
|
- staticcheck
|
||||||
|
text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."
|
||||||
|
|
|
@ -74,12 +74,14 @@ func (g *Manager) start() {
|
||||||
|
|
||||||
// Make SVC process
|
// Make SVC process
|
||||||
run := svc.Run
|
run := svc.Run
|
||||||
isWindowsService, err := svc.IsWindowsService()
|
|
||||||
|
//lint:ignore SA1019 We use IsAnInteractiveSession because IsWindowsService has a different permissions profile
|
||||||
|
isAnInteractiveSession, err := svc.IsAnInteractiveSession()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to ascertain if running as an Windows Service: %v", err)
|
log.Error("Unable to ascertain if running as an Windows Service: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !isWindowsService {
|
if isAnInteractiveSession {
|
||||||
log.Trace("Not running a service ... using the debug SVC manager")
|
log.Trace("Not running a service ... using the debug SVC manager")
|
||||||
run = debug.Run
|
run = debug.Run
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue