mirror of https://github.com/sbt/sbt.git
Fix waitWatch failure handling
The waitWatch command is very similar to shell in that it should override the onFailure command to be itself. It also enqueues itself to remaining commands whenever it reads a new command which made it unnecessary to append waitWatch to the runCommmand in Continuous.
This commit is contained in:
parent
90ca463c70
commit
5c508e4275
|
|
@ -1003,10 +1003,12 @@ object BuiltinCommands {
|
|||
|
||||
val s1 = exchange.run(s0)
|
||||
val exec: Exec = getExec(s1, Duration.Inf)
|
||||
val remaining: List[Exec] =
|
||||
Exec(FailureWall, None) :: Exec(s"${ContinuousCommands.waitWatch} $channel", None) ::
|
||||
s1.remainingCommands
|
||||
val newState = s1.copy(remainingCommands = exec +: remaining)
|
||||
val wait = s"${ContinuousCommands.waitWatch} $channel"
|
||||
val onFailure =
|
||||
s1.onFailure.map(of => if (of.commandLine == Shell) of.withCommandLine(wait) else of)
|
||||
val waitExec = Exec(wait, None)
|
||||
val remaining: List[Exec] = Exec(FailureWall, None) :: waitExec :: s1.remainingCommands
|
||||
val newState = s1.copy(remainingCommands = exec +: remaining, onFailure = onFailure)
|
||||
if (exec.commandLine.trim.isEmpty) newState
|
||||
else newState.clearGlobalLog
|
||||
case _ => s0
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
|||
case None => StandardMain.exchange.run(s) -> ConsoleChannel.defaultName
|
||||
}
|
||||
val ws = ContinuousCommands.setupWatchState(channel, initialCount, commands, s1)
|
||||
s"${ContinuousCommands.runWatch} $channel" :: ws
|
||||
s"${ContinuousCommands.runWatch} $channel" :: s"${ContinuousCommands.waitWatch} $channel" :: ws
|
||||
}
|
||||
|
||||
@deprecated("The input task version of watch is no longer available", "1.4.0")
|
||||
|
|
@ -1279,7 +1279,7 @@ private[sbt] object ContinuousCommands {
|
|||
case None => state
|
||||
case Some(cs) =>
|
||||
val pre = StashOnFailure :: s"$preWatch $channel" :: Nil
|
||||
val post = FailureWall :: PopOnFailure :: s"$postWatch $channel" :: s"$waitWatch $channel" :: Nil
|
||||
val post = FailureWall :: PopOnFailure :: s"$postWatch $channel" :: Nil
|
||||
pre ::: cs.commands.toList ::: post ::: state
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue