Merge pull request #4991 from eatkins/watch-multi-command-error

Abort early in watch multi commands
This commit is contained in:
eugene yokota
2019-08-27 14:24:24 -04:00
committed by GitHub
5 changed files with 15 additions and 2 deletions
@@ -243,7 +243,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
case exec :: rest =>
val updatedState = MainLoop.processCommand(exec, s.copy(remainingCommands = rest))
val remaining =
updatedState.remainingCommands.takeWhile(_.commandLine != FailureWall)
updatedState.remainingCommands.takeWhile(_.commandLine != failureCommandName)
remaining match {
case Nil =>
updatedState.remainingCommands.forall(_.commandLine != failureCommandName)
@@ -351,7 +351,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
currentCount.getAndIncrement()
callbacks.beforeCommand()
// abort as soon as one of the tasks fails
valid.takeWhile(_._3.apply())
valid.takeWhile { case (_, _, task) => task() }
updateLegacyWatchState(s, configs.flatMap(_.inputs().map(_.glob)), currentCount.get())
()
}
@@ -0,0 +1,8 @@
import java.nio.file._
watchOnIteration := { (_, _, _) => Watch.CancelWatch }
val copyFile = taskKey[Unit]("copy a file")
copyFile := {
val base = baseDirectory.value.toPath
Files.copy(base / "changes" / "Foo.txt", base / "Foo.txt")
}
@@ -0,0 +1 @@
foo
@@ -0,0 +1 @@
object Foo {
+3
View File
@@ -0,0 +1,3 @@
> ~compile; copyFile
$ absent Foo.txt