From a35aac3449634b295178f0944b130b460d57de41 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Mon, 6 Jan 2025 11:22:28 -0500 Subject: [PATCH] [OTEL-2309] Fix panic in /otel-agent -h --- cmd/otel-agent/command/command.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/otel-agent/command/command.go b/cmd/otel-agent/command/command.go index 7ea79949cb799..e3873f9ab800f 100644 --- a/cmd/otel-agent/command/command.go +++ b/cmd/otel-agent/command/command.go @@ -73,7 +73,8 @@ func makeCommands(globalParams *subcommands.GlobalParams) *cobra.Command { true, // show env variable value in usage ) - if err := ef.Parse(os.Args[1:]); err != nil { + // There may be other env vars in addition to the ones in envflag.NewEnvFlag. Do not panic if those env vars do not have a help message (flag.ErrHelp) + if err := ef.Parse(os.Args[1:]); err != nil && err != flag.ErrHelp { panic(err) }