Skip to content

Commit bdc1697

Browse files
zeripath6543
andauthored
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 <[email protected]> * Yes staticcheck I know this is deprecated Signed-off-by: Andrew Thornton <[email protected]> * Just leave me alone lint Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: 6543 <[email protected]>
1 parent 6400668 commit bdc1697

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.golangci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,7 @@ issues:
110110
- text: "exitAfterDefer:"
111111
linters:
112112
- gocritic
113+
- path: modules/graceful/manager_windows.go
114+
linters:
115+
- staticcheck
116+
text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."

modules/graceful/manager_windows.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,14 @@ func (g *Manager) start() {
7474

7575
// Make SVC process
7676
run := svc.Run
77-
isWindowsService, err := svc.IsWindowsService()
77+
78+
//lint:ignore SA1019 We use IsAnInteractiveSession because IsWindowsService has a different permissions profile
79+
isAnInteractiveSession, err := svc.IsAnInteractiveSession()
7880
if err != nil {
7981
log.Error("Unable to ascertain if running as an Windows Service: %v", err)
8082
return
8183
}
82-
if !isWindowsService {
84+
if isAnInteractiveSession {
8385
log.Trace("Not running a service ... using the debug SVC manager")
8486
run = debug.Run
8587
}

0 commit comments

Comments
 (0)