From 9dd33bc3f9e6f6c7c5f80830729df76ebc7160f4 Mon Sep 17 00:00:00 2001 From: James Read Date: Fri, 12 Jul 2024 17:22:03 +0100 Subject: [PATCH] bugfix: Empty environment variable names causing exec failures on Windows, thanks @sirjmann92 ! (#353) --- internal/executor/executor.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/executor/executor.go b/internal/executor/executor.go index 443ef06..4e54947 100644 --- a/internal/executor/executor.go +++ b/internal/executor/executor.go @@ -380,7 +380,14 @@ func buildEnv(req *ExecutionRequest) []string { ret := append(os.Environ(), "OLIVETIN=1") for k, v := range req.Arguments { - ret = append(ret, fmt.Sprintf("%v=%v", strings.ToUpper(k), v)) + varName := fmt.Sprintf("%v", strings.TrimSpace(strings.ToUpper(k))) + + // Skip arguments that might not have a name (eg, confirmation), as this causes weird bugs on Windows. + if varName == "" { + continue + } + + ret = append(ret, fmt.Sprintf("%v=%v", varName, v)) } return ret