From bdc169772980285a89480a93c78731b6f45ee2ff Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 7 May 2021 10:27:31 +0100 Subject: [PATCH] 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 * Yes staticcheck I know this is deprecated Signed-off-by: Andrew Thornton * Just leave me alone lint Signed-off-by: Andrew Thornton Co-authored-by: 6543 <6543@obermui.de> --- .golangci.yml | 4 ++++ modules/graceful/manager_windows.go | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 88168af222b..0d7f90e263c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -110,3 +110,7 @@ issues: - text: "exitAfterDefer:" linters: - gocritic + - path: modules/graceful/manager_windows.go + linters: + - staticcheck + text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead." diff --git a/modules/graceful/manager_windows.go b/modules/graceful/manager_windows.go index b0e0d1ce38e..14923c2a9b7 100644 --- a/modules/graceful/manager_windows.go +++ b/modules/graceful/manager_windows.go @@ -74,12 +74,14 @@ func (g *Manager) start() { // Make SVC process 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 { log.Error("Unable to ascertain if running as an Windows Service: %v", err) return } - if !isWindowsService { + if isAnInteractiveSession { log.Trace("Not running a service ... using the debug SVC manager") run = debug.Run }