Skip to content

Commit

Permalink
Remove NO_WINDOWS_SERVICE env var
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanotti committed Dec 5, 2023
1 parent 5d8cbdf commit 9434655
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
2 changes: 1 addition & 1 deletion .chloggen/fix-running-as-service-detection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
Expand Down
9 changes: 0 additions & 9 deletions cmd/builder/internal/builder/templates/main_windows.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 0 additions & 9 deletions cmd/otelcorecol/main_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9434655

Please sign in to comment.