From de436d2af5d0c25787882c7e001b17cfa328d514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Gouteroux?= Date: Mon, 6 Nov 2023 16:33:50 +0100 Subject: [PATCH] fix(agentctl): set exit code 1 on non-runnable command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: François Gouteroux --- CHANGELOG.md | 2 ++ cmd/grafana-agentctl/main.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fbef786b1b1..581e6f75df5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,8 @@ Main (unreleased) ### Bugfixes +- Set exit code 1 on grafana-agentctl non-runnable command. (@fgouteroux) + - Fixed an issue where `loki.process` validation for stage `metric.counter` was allowing invalid combination of configuration options. (@thampiotr) diff --git a/cmd/grafana-agentctl/main.go b/cmd/grafana-agentctl/main.go index 6865a4bc412d..5219f85a0f2f 100644 --- a/cmd/grafana-agentctl/main.go +++ b/cmd/grafana-agentctl/main.go @@ -64,7 +64,9 @@ func main() { testLogs(), ) - _ = cmd.Execute() + if err := cmd.Execute(); err != nil { + os.Exit(1) + } } func configSyncCmd() *cobra.Command {