Skip to content

Commit e7dd5df

Browse files
Daniel Hjartlandsquashd
authored andcommitted
copy map at each cli step
1 parent 4e8e601 commit e7dd5df

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

checks/checks.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"fmt"
88
"io"
9+
"maps"
910
"net/http"
1011
"os"
1112
"os/exec"
@@ -42,7 +43,7 @@ func runCLICommand(command api.CLIStepCLICommand, variables map[string]string) (
4243
result.ExitCode = -2
4344
}
4445
result.Stdout = strings.TrimRight(string(b), " \n\t\r")
45-
result.Variables = variables
46+
result.Variables = maps.Clone(variables)
4647
return result
4748
}
4849

@@ -121,7 +122,7 @@ func runHTTPRequest(
121122
ResponseHeaders: headers,
122123
ResponseTrailers: trailers,
123124
BodyString: truncateAndStringifyBody(body),
124-
Variables: variables,
125+
Variables: maps.Clone(variables),
125126
Request: requestStep,
126127
}
127128
return result
@@ -172,10 +173,6 @@ func CLIChecks(cliData api.CLIData, overrideBaseURL string, ch chan tea.Msg) (re
172173
case step.HTTPRequest != nil:
173174
result := runHTTPRequest(client, baseURL, variables, *step.HTTPRequest)
174175
results[i].HTTPRequestResult = &result
175-
if result.Variables != nil {
176-
variables = result.Variables
177-
}
178-
179176
sendHTTPRequestResults(ch, *step.HTTPRequest, result, i)
180177

181178
default:

0 commit comments

Comments
 (0)