Skip to content

Commit

Permalink
Ignore failure to close file
Browse files Browse the repository at this point in the history
Fixes #2382
  • Loading branch information
pyricau committed Nov 11, 2022
1 parent 7d3fe63 commit 5528f4d
Showing 1 changed file with 8 additions and 1 deletion.
@@ -1,6 +1,7 @@
package shark

import java.io.File
import java.io.IOException
import okio.Buffer
import okio.BufferedSource
import okio.Okio
Expand Down Expand Up @@ -40,7 +41,13 @@ class ThrowingCancelableFileSourceProvider(
return channel.transferTo(position, byteCount, sink)
}

override fun close() = channel.close()
override fun close() {
try {
channel.close()
} catch (ignored: Throwable) {
SharkLog.d(ignored) { "Failed to close file, ignoring" }
}
}
}
}
}

0 comments on commit 5528f4d

Please sign in to comment.