Skip to content

Commit fffa903

Browse files
committed
some fixes
1 parent 09e638e commit fffa903

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

helm/polaris/build.gradle.kts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import java.io.OutputStream
2+
13
/*
24
* Licensed to the Apache Software Foundation (ASF) under one
35
* or more contributor license agreements. See the NOTICE file
@@ -34,7 +36,7 @@ dependencies { runtimeServerDistribution(project(":polaris-server", "distributio
3436

3537
val helmTestReportsDir = layout.buildDirectory.dir("reports")
3638

37-
private val missingDependencyExitCode = -42
39+
private val missingDependencyExitCode = 42
3840

3941
val helmChecks =
4042
"""
@@ -340,15 +342,18 @@ tasks.named("check") { dependsOn(test, intTest) }
340342
tasks.named("assemble") { dependsOn(helmDocs) }
341343

342344
fun Exec.runShellScript(script: String, outputFile: File) {
345+
var outStream: OutputStream? = null
343346
doFirst {
344347
outputFile.parentFile.mkdirs()
345-
val outStream = outputFile.outputStream()
348+
outStream = outputFile.outputStream()
346349
standardOutput = outStream
347350
errorOutput = outStream
348351
}
349352
commandLine = listOf("bash", "-c", script.trimIndent())
350353
this.isIgnoreExitValue = true
351354
doLast {
355+
// Close the output stream before reading the file to avoid race conditions
356+
outStream?.close()
352357
val exitValue = executionResult.get().exitValue
353358
if (exitValue != 0) {
354359
if (exitValue == missingDependencyExitCode) {

0 commit comments

Comments
 (0)