aboutsummaryrefslogtreecommitdiff
path: root/plugins/uber-jar/src/uberjar/TryWithResources.scala
blob: c2f11f9fc294edd20ad0281162133425507b9164 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
package cbt.uberjar

import java.io.Closeable

import scala.util.Try

private[cbt] object TryWithResources {
  def withCloseable[T <: Closeable, R](t: T)(f: T => R): Try[R] = {
    val result = Try(f(t))
    t.close()
    result
  }
}