Skip to content

Commit

Permalink
Close gradle build stream in finally block
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Jan 24, 2024
1 parent 00c6b62 commit de8f2f2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ group = "org.apache.pekko"

def getVersionFromParentSbtBuild() {
ByteArrayOutputStream os = new ByteArrayOutputStream()
String parentDir = project.rootDir.getParentFile().getPath()
exec {
workingDir parentDir
commandLine 'sbt', '--no-colors', '--error', 'set aggregate := false; print version'
standardOutput os
try {
String parentDir = project.rootDir.getParentFile().getPath()
exec {
workingDir parentDir
commandLine 'sbt', '--no-colors', '--error', 'set aggregate := false; print version'
standardOutput os
}
} finally {
os.close()
}
os.close()
String finalVersion = os.toString().trim()
project.logger.info("Derived gradle version from parent sbt build: $finalVersion")
return finalVersion
Expand Down

0 comments on commit de8f2f2

Please sign in to comment.