mirror of https://github.com/sbt/sbt.git
Reinstate watchBeforeCommand callback
A user reported that the watchBeforeCommand callback was not being
invoked in sbt 1.4.{0, 1}. This was an oversight that occurred when
refactoring watch for the thin client and there previously had been no
regression test for that callback.
This commit is contained in:
parent
a09e6e2a25
commit
69be879684
|
|
@ -1327,7 +1327,10 @@ private[sbt] object ContinuousCommands {
|
|||
}
|
||||
|
||||
private[sbt] val preWatchCommand = watchCommand(preWatch) { (channel, state) =>
|
||||
watchState(state, channel).beforeCommand(state)
|
||||
val ws = watchState(state, channel)
|
||||
val newState = ws.beforeCommand(state)
|
||||
ws.callbacks.beforeCommand()
|
||||
newState
|
||||
}
|
||||
private[sbt] val postWatchCommand = watchCommand(postWatch) { (channel, state) =>
|
||||
val cs = watchState(state, channel)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
import java.nio.file.{ Files, Paths }
|
||||
|
||||
watchBeforeCommand := { () => Files.write(Paths.get("foo"), "foo".getBytes) }
|
||||
|
||||
watchOnIteration := { (_, _, _) => sbt.nio.Watch.CancelWatch }
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
> ~compile
|
||||
|
||||
$ exists foo
|
||||
Loading…
Reference in New Issue