mirror of https://github.com/sbt/sbt.git
Abort early in watch multi commands
During refactoring of Continuous, I inadvertently changed the semantics of `~` so that all multi commands were run regardless of whether or not an earlier command had failed. I fixed the issue and added a regression test.
This commit is contained in:
parent
110f54a044
commit
6ec9edb733
|
|
@ -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 {
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
> ~compile; copyFile
|
||||
|
||||
$ absent Foo.txt
|
||||
Loading…
Reference in New Issue