Skip to content

Commit

Permalink
Replace IsAnInteractiveSession by IsWindowsService (#4253)
Browse files Browse the repository at this point in the history
* Replace IsAnInteractiveSession by IsWindowsService

* rename checkUseInteractiveMode to checkWindowsService
  • Loading branch information
danielqsj committed Oct 27, 2021
1 parent fd61bbb commit ea8b4f4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/otelcol/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func run(set service.CollectorSettings) error {
if useInteractiveMode, err := checkUseInteractiveMode(); err != nil {
if useInteractiveMode, err := checkWindowsService(); err != nil {
return err
} else if useInteractiveMode {
return runInteractive(set)
Expand All @@ -36,7 +36,7 @@ func run(set service.CollectorSettings) error {
}
}

func checkUseInteractiveMode() (bool, error) {
func checkWindowsService() (bool, error) {
// If environment variable NO_WINDOWS_SERVICE is set with any value other
// than 0, use interactive mode instead of running as a service. This should
// be set in case running as a service is not possible or desired even
Expand All @@ -45,10 +45,10 @@ func checkUseInteractiveMode() (bool, error) {
return true, nil
}

if isInteractiveSession, err := svc.IsAnInteractiveSession(); err != nil {
return false, fmt.Errorf("failed to determine if we are running in an interactive session %w", err)
if isWindowsService, err := svc.IsWindowsService(); err != nil {
return false, fmt.Errorf("failed to determine if we are running as a Windows service %w", err)
} else {
return isInteractiveSession, nil
return isWindowsService, nil
}
}

Expand Down

0 comments on commit ea8b4f4

Please sign in to comment.