Skip to content

Commit 768b49c

Browse files
committed
Pass test run exit code to cleanup
1 parent 46124f7 commit 768b49c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.ci/run-tests.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ function log {
6767
}
6868

6969
function cleanup {
70-
$status=$?
70+
param(
71+
$RunExitCode
72+
)
7173

7274
$runParams = @{
7375
NODE_NAME= $NODE_NAME
@@ -78,12 +80,12 @@ function cleanup {
7880
./.ci/run-elasticsearch.ps1 @runParams
7981

8082
# Report status and exit
81-
if ($status -eq 0) {
83+
if ($RunExitCode -eq 0) {
8284
log "run-tests" -Level Success
8385
exit 0
8486
} else {
8587
log "failure during run-tests" -Level Error
86-
exit $status
88+
exit $RunExitCode
8789
}
8890
}
8991

@@ -126,8 +128,10 @@ docker run `
126128
elastic/elasticsearch-rs `
127129
cargo test $CARGO_TEST_FLAGS
128130

129-
if ($LASTEXITCODE) {
131+
$runExitCode = $LASTEXITCODE
132+
133+
if ($runExitCode -ne 0) {
130134
docker rm elasticsearch-rs
131135
}
132136

133-
cleanup
137+
cleanup $runExitCode

0 commit comments

Comments
 (0)