mirror of
https://github.com/sbt/sbt.git
synced 2026-09-03 16:39:24 +02:00
Exec and CommandExchange refactoring
This commit is contained in:
@@ -6,7 +6,7 @@ import sbt.internal.util.complete.{ Completion, Completions, DefaultParsers, His
|
||||
import sbt.internal.util.Types.{ const, idFun }
|
||||
import sbt.internal.inc.classpath.ClasspathUtilities.toLoader
|
||||
import sbt.internal.inc.ModuleUtilities
|
||||
import sbt.internal.{ CommandRequest, CommandSource, CommandStatus }
|
||||
import sbt.internal.{ Exec, CommandSource, CommandStatus }
|
||||
import DefaultParsers._
|
||||
import Function.tupled
|
||||
import Command.applyEffect
|
||||
@@ -193,17 +193,13 @@ object BasicCommands {
|
||||
}
|
||||
}
|
||||
|
||||
def server = Command.command(Server, Help.more(Server, ServerDetailed)) { s =>
|
||||
def server = Command.command(Server, Help.more(Server, ServerDetailed)) { s0 =>
|
||||
val exchange = State.exchange
|
||||
exchange.channels foreach { x =>
|
||||
x.runOrResume(CommandStatus(s, true))
|
||||
x.setStatus(CommandStatus(s, true), None)
|
||||
}
|
||||
val CommandRequest(source, line) = exchange.blockUntilNextCommand
|
||||
val newState = s.copy(onFailure = Some(Server), remainingCommands = line +: Server +: s.remainingCommands).setInteractive(true)
|
||||
exchange.channels foreach { x =>
|
||||
x.setStatus(CommandStatus(newState, false), Some(source))
|
||||
}
|
||||
val s1 = exchange.run(s0)
|
||||
exchange.publishStatus(CommandStatus(s0, true), None)
|
||||
val Exec(source, line) = exchange.blockUntilNextExec
|
||||
val newState = s1.copy(onFailure = Some(Server), remainingCommands = line +: Server +: s1.remainingCommands).setInteractive(true)
|
||||
exchange.publishStatus(CommandStatus(newState, false), Some(source))
|
||||
if (line.trim.isEmpty) newState
|
||||
else newState.clearGlobalLog
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user