From 42ad86a084f6007d2a95a89e53da3cff6b96c806 Mon Sep 17 00:00:00 2001 From: Kevin McConnell Date: Wed, 1 May 2024 12:23:36 +0100 Subject: [PATCH] Failure to start wrapped process should not panic If we're unable to execute the wrapped process, we should log and error and return a non-zero exit code. However, previously we were triggering a `panic` in this case, which was unnecessary and alarming. --- internal/service.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/service.go b/internal/service.go index 0cff928..eedea69 100644 --- a/internal/service.go +++ b/internal/service.go @@ -2,6 +2,7 @@ package internal import ( "fmt" + "log/slog" "net/url" "os" ) @@ -37,7 +38,8 @@ func (s *Service) Run() int { exitCode, err := upstream.Run() if err != nil { - panic(err) + slog.Error("Failed to start wrapped process", "command", s.config.UpstreamCommand, "args", s.config.UpstreamArgs, "error", err) + return 1 } return exitCode