Skip to content

Commit d90a1f5

Browse files
committed
use OutputStream.use instead of manually closing it in a "finally" block
1 parent f94719d commit d90a1f5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

firebase-dataconnect/gradleplugin/plugin/src/main/kotlin/com/google/firebase/dataconnect/gradle/plugin/DataConnectGenerateCodeTask.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,9 @@ private fun determineCallingConvention(
194194
callingConvention,
195195
logFile.absolutePath
196196
)
197-
val logFileStream = logFile.outputStream()
198197

199198
val exitCode: Int =
200-
try {
199+
logFile.outputStream().use { logFileStream ->
201200
execOperations
202201
.exec { execSpec ->
203202
execSpec.run {
@@ -212,8 +211,6 @@ private fun determineCallingConvention(
212211
}
213212
}
214213
.exitValue
215-
} finally {
216-
logFileStream.close()
217214
}
218215

219216
val callingConventionSupported = exitCode == 0

0 commit comments

Comments
 (0)