Catch interrupted exceptions in blockUntilNextExec

It is possible for an InterruptedException to be thrown here because of
logic in NetworkClient. This seemed to be the root cause of the fix I
tried in ca251eb7c8 so I'm reverting that
commit.

Revert "Catch interrupted exception in shell"

This reverts commit ca251eb7c8.
This commit is contained in:
Ethan Atkins 2020-09-27 10:16:04 -07:00
parent 5fee13ad5a
commit 3966d2fcb2
2 changed files with 13 additions and 14 deletions

View File

@ -1041,19 +1041,17 @@ object BuiltinCommands {
.extract(s1)
.getOpt(Keys.minForcegcInterval)
.getOrElse(GCUtil.defaultMinForcegcInterval)
try {
val exec: Exec = getExec(s1, minGCInterval)
val newState = s1
.copy(
onFailure = Some(Exec(Shell, None)),
remainingCommands = exec +: Exec(Shell, None) +: s1.remainingCommands
)
.setInteractive(true)
val res =
if (exec.commandLine.trim.isEmpty) newState
else newState.clearGlobalLog
res
} catch { case _: InterruptedException => s1.exit(true) }
val exec: Exec = getExec(s1, minGCInterval)
val newState = s1
.copy(
onFailure = Some(Exec(Shell, None)),
remainingCommands = exec +: Exec(Shell, None) +: s1.remainingCommands
)
.setInteractive(true)
val res =
if (exec.commandLine.trim.isEmpty) newState
else newState.clearGlobalLog
res
}
}

View File

@ -91,7 +91,7 @@ private[sbt] final class CommandExchange {
case s @ Seq(_, _) => Some(s.min)
case s => s.headOption
}
Option(deadline match {
try Option(deadline match {
case Some(d: Deadline) =>
commandQueue.poll(d.timeLeft.toMillis + 1, TimeUnit.MILLISECONDS) match {
case null if idleDeadline.fold(false)(_.isOverdue) =>
@ -106,6 +106,7 @@ private[sbt] final class CommandExchange {
}
case _ => commandQueue.take
})
catch { case _: InterruptedException => None }
}
poll match {
case Some(exec) if exec.source.fold(true)(s => channels.exists(_.name == s.channelName)) =>