mirror of https://github.com/sbt/sbt.git
Merge pull request #6164 from eatkins/thin-client-cancel
Make the thin client `cancel` command work reliably
This commit is contained in:
commit
8e7e3efea1
|
|
@ -162,7 +162,7 @@ private[sbt] final class CommandExchange {
|
|||
e.source.map(_.channelName) == Some(c.name) && e.commandLine != Shutdown
|
||||
}
|
||||
currentExec.filter(_.source.map(_.channelName) == Some(c.name)).foreach { e =>
|
||||
Util.ignoreResult(NetworkChannel.cancel(e.execId, e.execId.getOrElse("0")))
|
||||
Util.ignoreResult(NetworkChannel.cancel(e.execId, e.execId.getOrElse("0"), force = false))
|
||||
}
|
||||
try commandQueue.put(Exec(s"${ContinuousCommands.stopWatch} ${c.name}", None))
|
||||
catch { case _: InterruptedException => }
|
||||
|
|
@ -447,7 +447,7 @@ private[sbt] final class CommandExchange {
|
|||
terminal.write(13, 13, 13, 4)
|
||||
terminal.printStream.println("\nconsole session killed by remote sbt client")
|
||||
} else {
|
||||
Util.ignoreResult(NetworkChannel.cancel(e.execId, e.execId.getOrElse("0")))
|
||||
Util.ignoreResult(NetworkChannel.cancel(e.execId, e.execId.getOrElse("0"), force = true))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -923,7 +923,8 @@ object NetworkChannel {
|
|||
case object InBody extends ChannelState
|
||||
private[sbt] def cancel(
|
||||
execID: Option[String],
|
||||
id: String
|
||||
id: String,
|
||||
force: Boolean
|
||||
): Either[String, String] = {
|
||||
|
||||
Option(EvaluateTask.currentlyRunningTaskEngine.get) match {
|
||||
|
|
@ -945,7 +946,7 @@ object NetworkChannel {
|
|||
|
||||
// direct comparison on strings and
|
||||
// remove hotspring unicode added character for numbers
|
||||
if (checkId) {
|
||||
if (checkId || force) {
|
||||
runningEngine.cancelAndShutdown()
|
||||
Right(runningExecId)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue