mirror of https://github.com/sbt/sbt.git
Rename --close-io-streams to --detach-stdio
This commit is contained in:
parent
bba3d08aac
commit
d24cd2b3f7
|
|
@ -212,7 +212,7 @@ $AliasCommand name=
|
||||||
"Provides an interactive prompt from which commands can be run on a server."
|
"Provides an interactive prompt from which commands can be run on a server."
|
||||||
def DashClient: String = "-client"
|
def DashClient: String = "-client"
|
||||||
def DashDashClient: String = "--client"
|
def DashDashClient: String = "--client"
|
||||||
def CloseIOStreams: String = "--close-io-streams"
|
def DashDashDetachStdio: String = "--detach-stdio"
|
||||||
|
|
||||||
def StashOnFailure: String = "sbtStashOnFailure"
|
def StashOnFailure: String = "sbtStashOnFailure"
|
||||||
def PopOnFailure: String = "sbtPopOnFailure"
|
def PopOnFailure: String = "sbtPopOnFailure"
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,8 @@ object BasicKeys {
|
||||||
"List of template resolver infos.",
|
"List of template resolver infos.",
|
||||||
1000
|
1000
|
||||||
)
|
)
|
||||||
private[sbt] val closeIOStreams = AttributeKey[Boolean](
|
private[sbt] val detachStdio = AttributeKey[Boolean](
|
||||||
"close-io-streams",
|
"detach-stdio",
|
||||||
"Toggles wheter or not to close system in, out and error when the server starts.",
|
"Toggles wheter or not to close system in, out and error when the server starts.",
|
||||||
1000
|
1000
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ class NetworkClient(
|
||||||
).mkString(",")
|
).mkString(",")
|
||||||
|
|
||||||
val cmd = List(arguments.sbtScript) ++ arguments.sbtArguments ++
|
val cmd = List(arguments.sbtScript) ++ arguments.sbtArguments ++
|
||||||
List(BasicCommandStrings.CloseIOStreams, BasicCommandStrings.DashDashServer)
|
List(BasicCommandStrings.DashDashDetachStdio, BasicCommandStrings.DashDashServer)
|
||||||
val processBuilder =
|
val processBuilder =
|
||||||
new ProcessBuilder(cmd: _*)
|
new ProcessBuilder(cmd: _*)
|
||||||
.directory(arguments.baseDirectory)
|
.directory(arguments.baseDirectory)
|
||||||
|
|
|
||||||
|
|
@ -86,14 +86,14 @@ private[sbt] object xMain {
|
||||||
NetworkClient.run(dealiasBaseDirectory(configuration), args)
|
NetworkClient.run(dealiasBaseDirectory(configuration), args)
|
||||||
Exit(0)
|
Exit(0)
|
||||||
} else {
|
} else {
|
||||||
val closeStreams = userCommands.exists(_ == BasicCommandStrings.CloseIOStreams)
|
val detachStdio = userCommands.exists(_ == BasicCommandStrings.DashDashDetachStdio)
|
||||||
val state0 = StandardMain
|
val state0 = StandardMain
|
||||||
.initialState(
|
.initialState(
|
||||||
dealiasBaseDirectory(configuration),
|
dealiasBaseDirectory(configuration),
|
||||||
Seq(defaults, early),
|
Seq(defaults, early),
|
||||||
runEarly(DefaultsCommand) :: runEarly(InitCommand) :: BootCommand :: Nil
|
runEarly(DefaultsCommand) :: runEarly(InitCommand) :: BootCommand :: Nil
|
||||||
)
|
)
|
||||||
.put(BasicKeys.closeIOStreams, closeStreams)
|
.put(BasicKeys.detachStdio, detachStdio)
|
||||||
val state = bootServerSocket match {
|
val state = bootServerSocket match {
|
||||||
case Some(l) => state0.put(Keys.bootServerSocket, l)
|
case Some(l) => state0.put(Keys.bootServerSocket, l)
|
||||||
case _ => state0
|
case _ => state0
|
||||||
|
|
@ -230,7 +230,9 @@ object StandardMain {
|
||||||
|
|
||||||
import BasicCommandStrings.isEarlyCommand
|
import BasicCommandStrings.isEarlyCommand
|
||||||
val userCommands =
|
val userCommands =
|
||||||
configuration.arguments.map(_.trim).filterNot(_ == BasicCommandStrings.CloseIOStreams)
|
configuration.arguments
|
||||||
|
.map(_.trim)
|
||||||
|
.filterNot(_ == BasicCommandStrings.DashDashDetachStdio)
|
||||||
val (earlyCommands, normalCommands) = (preCommands ++ userCommands).partition(isEarlyCommand)
|
val (earlyCommands, normalCommands) = (preCommands ++ userCommands).partition(isEarlyCommand)
|
||||||
val commands = (earlyCommands ++ normalCommands).toList map { x =>
|
val commands = (earlyCommands ++ normalCommands).toList map { x =>
|
||||||
Exec(x, None)
|
Exec(x, None)
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,11 @@ private[sbt] final class CommandExchange {
|
||||||
firstInstance.set(false)
|
firstInstance.set(false)
|
||||||
}
|
}
|
||||||
Terminal.setBootStreams(null, null)
|
Terminal.setBootStreams(null, null)
|
||||||
if (s.get(BasicKeys.closeIOStreams).getOrElse(false)) Terminal.close()
|
|
||||||
|
if (s.get(BasicKeys.detachStdio).getOrElse(false)) {
|
||||||
|
Terminal.close()
|
||||||
|
}
|
||||||
|
|
||||||
s.get(Keys.bootServerSocket).foreach(_.close())
|
s.get(Keys.bootServerSocket).foreach(_.close())
|
||||||
}
|
}
|
||||||
s.remove(Keys.bootServerSocket)
|
s.remove(Keys.bootServerSocket)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue