diff --git a/.chloggen/fix-running-as-service-detection.yaml b/.chloggen/fix-running-as-service-detection.yaml index f6d8b01c1d0..d5f3909e6c2 100644 --- a/.chloggen/fix-running-as-service-detection.yaml +++ b/.chloggen/fix-running-as-service-detection.yaml @@ -15,7 +15,7 @@ issues: [7350] # (Optional) One or more lines of additional information to render under the primary note. # These lines will be padded with 2 spaces and then inserted directly into the document. # Use pipe (|) for multiline entries. -subtext: This fix should make setting the `NO_WINDOWS_SERVICE` environment variable unnecessary. +subtext: Removed the `NO_WINDOWS_SERVICE` environment variable given it is not needed anymore. # Optional: The change log or logs in which this entry should be included. # e.g. '[user]' or '[user, api]' diff --git a/cmd/builder/internal/builder/templates/main_windows.go.tmpl b/cmd/builder/internal/builder/templates/main_windows.go.tmpl index 043f6ba39ba..9166599f83b 100644 --- a/cmd/builder/internal/builder/templates/main_windows.go.tmpl +++ b/cmd/builder/internal/builder/templates/main_windows.go.tmpl @@ -7,21 +7,12 @@ package main import ( "fmt" - "os" "golang.org/x/sys/windows" "golang.org/x/sys/windows/svc" "go.opentelemetry.io/collector/otelcol" ) func run(params otelcol.CollectorSettings) error { - // There shouldn't be any reason to use NO_WINDOWS_SERVICE anymore, but, - // keeping it as a forcing mechanism or if someone is concerned about - // the cost of attempting to run as a service before falling back to - // interactive mode. - if value, present := os.LookupEnv("NO_WINDOWS_SERVICE"); present && value != "0" { - return runInteractive(params) - } - // No need to supply service name when startup is invoked through // the Service Control Manager directly. if err := svc.Run("", otelcol.NewSvcHandler(params)); err != nil { diff --git a/cmd/otelcorecol/main_windows.go b/cmd/otelcorecol/main_windows.go index 7898bf00531..6237937b50e 100644 --- a/cmd/otelcorecol/main_windows.go +++ b/cmd/otelcorecol/main_windows.go @@ -7,7 +7,6 @@ package main import ( "fmt" - "os" "syscall" "golang.org/x/sys/windows" @@ -17,14 +16,6 @@ import ( ) func run(params otelcol.CollectorSettings) error { - // There shouldn't be any reason to use NO_WINDOWS_SERVICE anymore, but, - // keeping it as a forcing mechanism or if someone is concerned about - // the cost of attempting to run as a service before falling back to - // interactive mode. - if value, present := os.LookupEnv("NO_WINDOWS_SERVICE"); present && value != "0" { - return runInteractive(params) - } - // No need to supply service name when startup is invoked through // the Service Control Manager directly. if err := svc.Run("", otelcol.NewSvcHandler(params)); err != nil {