runCatchingInterruptible
Like runCatchingCancellable, but also rethrows InterruptedException, so neither coroutine cancellation nor thread interruption is swallowed.
Use it around blocking calls. The JVM clears a thread's interrupt flag when it throws InterruptedException, so catching that exception in a Result would lose the interruption; rethrowing it leaves it for a caller to handle.
Return
a Result wrapping the success value or the caught exception (excluding CancellationException and InterruptedException)
Parameters
block
the code to execute
Type Parameters
R
the result type
Throws
CancellationException
if the block throws a cancellation exception
if the block throws an interrupted exception