Skip to content

Commit

Permalink
Merge pull request #2444 from square/py/close_crash_again
Browse files Browse the repository at this point in the history
Ignore failure to close file
  • Loading branch information
pyricau committed Nov 11, 2022
2 parents 7d3fe63 + 5528f4d commit 2e6488d
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 2e6488d

Please sign in to comment.