This is where we can multiplex commands

This commit is contained in:
Eugene Yokota 2016-03-02 04:02:03 +01:00
parent ec0fe7bb21
commit 649dc0ce3c
4 changed files with 10 additions and 8 deletions

View File

@ -176,6 +176,7 @@ lazy val actionsProj = (project in file("main-actions")).
// General command support and core commands not specific to a build system
lazy val commandProj = (project in file("main-command")).
dependsOn(serverProj).
settings(
testedBaseSettings,
name := "Command",

View File

@ -13,6 +13,7 @@ import BasicCommandStrings._
import CommandUtil._
import BasicKeys._
import sbt.server.Server
import java.io.File
import sbt.io.IO
@ -179,6 +180,9 @@ object BasicCommands {
}
def shell = Command.command(Shell, Help.more(Shell, ShellDetailed)) { s =>
// TODO hook it in, start in the right place, shutdown on termination
val server = Server.start("127.0.0.1", 12700)
val history = (s get historyPath) getOrElse Some(new File(s.baseDir, ".history"))
val prompt = (s get shellPrompt) match { case Some(pf) => pf(s); case None => "> " }
val reader = new FullReader(history, s.combinedParser)

View File

@ -7,12 +7,12 @@ import java.net.{ SocketTimeoutException, InetAddress, ServerSocket }
import java.util.concurrent.ConcurrentLinkedQueue
import java.util.concurrent.atomic.AtomicBoolean
sealed trait ServerInstance {
def shutdown(): Unit
def nextCommand(): Option[Command]
}
object Server {
trait ServerInstance {
def shutdown(): Unit
}
def start(host: String, port: Int): ServerInstance =
new ServerInstance {

View File

@ -84,9 +84,6 @@ object StandardMain {
/** The common interface to standard output, used for all built-in ConsoleLoggers. */
val console = ConsoleOut.systemOutOverwrite(ConsoleOut.overwriteContaining("Resolving "))
// TODO hook it in, start in the right place, shutdown on termination
val server = sbt.server.Server.start("127.0.0.1", 12700)
def initialGlobalLogging: GlobalLogging = GlobalLogging.initial(MainLogging.globalDefault(console), File.createTempFile("sbt", ".log"), console)
def initialState(configuration: xsbti.AppConfiguration, initialDefinitions: Seq[Command], preCommands: Seq[String]): State =