mirror of https://github.com/sbt/sbt.git
Add atMost parameter
This commit is contained in:
parent
b78e4f0919
commit
c8f52e6281
|
|
@ -865,14 +865,19 @@ object Project extends ProjectExtra {
|
|||
}
|
||||
}
|
||||
|
||||
/** implicitly injected to tasks that return PromiseWrap.
|
||||
*/
|
||||
final class RichTaskPromise[A](i: Def.Initialize[Task[PromiseWrap[A]]]) {
|
||||
import scala.concurrent.Await
|
||||
import scala.concurrent.duration._
|
||||
def await: Def.Initialize[Task[A]] =
|
||||
|
||||
def await: Def.Initialize[Task[A]] = await(Duration.Inf)
|
||||
|
||||
def await(atMost: Duration): Def.Initialize[Task[A]] =
|
||||
(Def
|
||||
.task {
|
||||
val p = i.value
|
||||
val result: A = Await.result(p.underlying.future, Duration.Inf)
|
||||
val result: A = Await.result(p.underlying.future, atMost)
|
||||
result
|
||||
})
|
||||
.tag(Tags.Sentinel)
|
||||
|
|
|
|||
Loading…
Reference in New Issue