mirror of https://github.com/sbt/sbt.git
Merge pull request #4058 from retronym/topic/quietly-cancel
Avoid printing RejectedExectionExeption stack trace after cancellation
This commit is contained in:
commit
a8c1239e32
|
|
@ -4,7 +4,7 @@ import sbt.contraband.ContrabandPlugin.autoImport._
|
||||||
|
|
||||||
object Dependencies {
|
object Dependencies {
|
||||||
// WARNING: Please Scala update versions in PluginCross.scala too
|
// WARNING: Please Scala update versions in PluginCross.scala too
|
||||||
val scala212 = "2.12.4"
|
val scala212 = "2.12.5"
|
||||||
val baseScalaVersion = scala212
|
val baseScalaVersion = scala212
|
||||||
|
|
||||||
// sbt modules
|
// sbt modules
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ import java.util.concurrent.{
|
||||||
CompletionService => JCompletionService,
|
CompletionService => JCompletionService,
|
||||||
Executor,
|
Executor,
|
||||||
Executors,
|
Executors,
|
||||||
ExecutorCompletionService
|
ExecutorCompletionService,
|
||||||
|
RejectedExecutionException,
|
||||||
}
|
}
|
||||||
|
|
||||||
object CompletionService {
|
object CompletionService {
|
||||||
|
|
@ -33,7 +34,9 @@ object CompletionService {
|
||||||
def take() = completion.take().get()
|
def take() = completion.take().get()
|
||||||
}
|
}
|
||||||
def submit[T](work: () => T, completion: JCompletionService[T]): () => T = {
|
def submit[T](work: () => T, completion: JCompletionService[T]): () => T = {
|
||||||
val future = completion.submit { new Callable[T] { def call = work() } }
|
val future = try completion.submit { new Callable[T] { def call = work() } } catch {
|
||||||
|
case _: RejectedExecutionException => throw Incomplete(None, message = Some("cancelled"))
|
||||||
|
}
|
||||||
() =>
|
() =>
|
||||||
future.get()
|
future.get()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
package sbt
|
package sbt
|
||||||
|
|
||||||
import sbt.internal.util.ErrorHandling.wideConvert
|
import sbt.internal.util.ErrorHandling.wideConvert
|
||||||
import sbt.internal.util.{ DelegatingPMap, PMap, RMap, IDSet, ~> }
|
import sbt.internal.util.{ DelegatingPMap, IDSet, PMap, RMap, ~> }
|
||||||
import sbt.internal.util.Types._
|
import sbt.internal.util.Types._
|
||||||
import Execute._
|
import Execute._
|
||||||
|
|
||||||
|
|
@ -77,6 +77,7 @@ private[sbt] final class Execute[A[_] <: AnyRef](
|
||||||
|
|
||||||
def run[T](root: A[T])(implicit strategy: Strategy): Result[T] =
|
def run[T](root: A[T])(implicit strategy: Strategy): Result[T] =
|
||||||
try { runKeep(root)(strategy)(root) } catch { case i: Incomplete => Inc(i) }
|
try { runKeep(root)(strategy)(root) } catch { case i: Incomplete => Inc(i) }
|
||||||
|
|
||||||
def runKeep[T](root: A[T])(implicit strategy: Strategy): RMap[A, Result] = {
|
def runKeep[T](root: A[T])(implicit strategy: Strategy): RMap[A, Result] = {
|
||||||
assert(state.isEmpty, "Execute already running/ran.")
|
assert(state.isEmpty, "Execute already running/ran.")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue