From b562344b6c9daa6ec505757510b1fe5707df8981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Tue, 22 Aug 2023 22:03:59 +0200 Subject: [PATCH] [Windows Service] Inherit exit code from agent (#4824) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke Co-authored-by: mattdurham --- CHANGELOG.md | 2 ++ cmd/grafana-agent-service/service.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2d9330e62d3..6eb31c6a59dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,8 @@ Main (unreleased) - Fix issue where Agent crashes when a blackbox modules config file is specified for blackbox integration. (@marctc) +- Fix issue where the code from agent would not return to the Windows Service Manager (@jkroepke) + - Fix issue where getting the support bundle failed due to using an HTTP Client that was not able to access the agent in-memory address. (@spartan0x117) - Fix an issue that lead the `loki.source.docker` container to use excessive diff --git a/cmd/grafana-agent-service/service.go b/cmd/grafana-agent-service/service.go index cb654b5c8851..10060e19cc28 100644 --- a/cmd/grafana-agent-service/service.go +++ b/cmd/grafana-agent-service/service.go @@ -3,6 +3,7 @@ package main import ( "context" "io" + "os" "os/exec" "github.com/go-kit/log" @@ -75,6 +76,7 @@ func (svc *serviceManager) Run(ctx context.Context) { } else { level.Info(svc.log).Log("msg", "service exited", "exit_code", exitCode) } + os.Exit(exitCode) } func (svc *serviceManager) buildCommand(ctx context.Context) *exec.Cmd {