Skip to content

Commit

Permalink
Close the KSP caches files after reading them
Browse files Browse the repository at this point in the history
(cherry picked from commit 1290ef8)
  • Loading branch information
ansman authored and KSP Auto Pick committed Sep 5, 2024
1 parent c32a756 commit 332a961
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ abstract class PersistentMap<K, V>(
@OptIn(ExperimentalSerializationApi::class)
protected fun <K, V> deserialize(serializer: KSerializer<Map<K, V>>, storage: File): MutableMap<K, V> {
return if (storage.exists()) {
Json.decodeFromStream(serializer, storage.inputStream()).toMutableMap()
storage.inputStream().use {
Json.decodeFromStream(serializer, it).toMutableMap()
}
} else {
mutableMapOf()
}
Expand Down

0 comments on commit 332a961

Please sign in to comment.