mirror of https://github.com/sbt/sbt.git
move calls to runExitHooks into the State.{reload,exit,reboot} commands. fixes #306
This commit is contained in:
parent
619b97d215
commit
fbe8630433
|
|
@ -295,7 +295,7 @@ object BuiltinCommands
|
|||
def clearOnFailure = Command.command(ClearOnFailure)(s => s.copy(onFailure = None))
|
||||
|
||||
def reboot = Command(RebootCommand, RebootBrief, RebootDetailed)(rebootParser) { (s, full) =>
|
||||
s.runExitHooks().reboot(full)
|
||||
s.reboot(full)
|
||||
}
|
||||
def rebootParser(s: State) = token(Space ~> "full" ^^^ true) ?? false
|
||||
|
||||
|
|
@ -533,9 +533,7 @@ object BuiltinCommands
|
|||
|
||||
def project = Command.make(ProjectCommand, projectBrief, projectDetailed)(ProjectNavigation.command)
|
||||
|
||||
def exit = Command.command(TerminateAction, exitBrief, exitBrief ) ( doExit )
|
||||
|
||||
def doExit(s: State): State = s.runExitHooks().exit(true)
|
||||
def exit = Command.command(TerminateAction, exitBrief, exitBrief ) ( _ exit true )
|
||||
|
||||
def loadFailed = Command.command(LoadFailed)(handleLoadFailed)
|
||||
@tailrec def handleLoadFailed(s: State): State =
|
||||
|
|
|
|||
|
|
@ -163,11 +163,11 @@ object State
|
|||
def setNext(n: Next) = s.copy(next = n)
|
||||
def setResult(ro: Option[xsbti.MainResult]) = ro match { case None => continue; case Some(r) => setNext(new Return(r)) }
|
||||
def continue = setNext(Continue)
|
||||
def reboot(full: Boolean) = throw new xsbti.FullReload(s.remainingCommands.toArray, full)
|
||||
def reload = setNext(new Return(defaultReload(s)))
|
||||
def reboot(full: Boolean) ={ runExitHooks(); throw new xsbti.FullReload(s.remainingCommands.toArray, full) }
|
||||
def reload = runExitHooks().setNext(new Return(defaultReload(s)))
|
||||
def clearGlobalLog = setNext(ClearGlobalLog)
|
||||
def keepLastLog = setNext(KeepLastLog)
|
||||
def exit(ok: Boolean) = setNext(new Return(Exit(if(ok) 0 else 1)))
|
||||
def exit(ok: Boolean) = runExitHooks().setNext(new Return(Exit(if(ok) 0 else 1)))
|
||||
def get[T](key: AttributeKey[T]) = s.attributes get key
|
||||
def put[T](key: AttributeKey[T], value: T) = s.copy(attributes = s.attributes.put(key, value))
|
||||
def update[T](key: AttributeKey[T])(f: Option[T] => T): State = put(key, f(get(key)))
|
||||
|
|
|
|||
Loading…
Reference in New Issue