Revert run switching on 1.x

**Problem**
client-side run apparently won't work for Scala.JS,
so forcing sbtn users to client-side run will break the Scala.JS users.

**Solution**
This reverts the client-side run on sbt 1.x, while retaining the
mechanism for sbt 2.x usages via sbtn.
Now, if `run / connectInput := true` is true, stdout will not display on sbtn.
This commit is contained in:
Eugene Yokota 2025-03-03 04:34:19 -05:00
parent f43030a2c2
commit 5d5fe21ec5
2 changed files with 1 additions and 21 deletions

View File

@ -148,21 +148,6 @@ final class NetworkChannel(
self.onCancellationRequest(execId, crp)
}
// Take over commandline for network channel
private val networkCommand: PartialFunction[String, String] = {
case cmd if cmd.split(" ").head.split("/").last == "run" =>
s"clientJob $cmd"
}
override protected def appendExec(commandLine: String, execId: Option[String]): Boolean =
if (clientCanWork && networkCommand.isDefinedAt(commandLine))
super.appendExec(networkCommand(commandLine), execId)
else super.appendExec(commandLine, execId)
override private[sbt] def onCommandLine(cmd: String): Boolean =
if (clientCanWork && networkCommand.isDefinedAt(cmd))
appendExec(networkCommand(cmd), None)
else super.onCommandLine(cmd)
protected def setInitializeOption(opts: InitializeOption): Unit = initializeOption.set(opts)
// Returns true if sbtn has declared with canWork: true

View File

@ -68,7 +68,7 @@ object ClientTest extends AbstractServerTest {
false
)
)
private def clientWithStdoutLines(args: String*): (Int, Seq[String]) = {
def clientWithStdoutLines(args: String*): (Int, Seq[String]) = {
val out = new CachingPrintStream
val exitCode = background(
NetworkClient.client(
@ -120,11 +120,6 @@ object ClientTest extends AbstractServerTest {
test("three commands with middle failure") { _ =>
assert(client("compile;willFail;willSucceed") == 1)
}
test("run") { _ =>
val (exitCode, lines) = clientWithStdoutLines("run")
assert(exitCode == 0)
assert(lines.toList.exists(_.endsWith("Hello, World!")))
}
test("compi completions") { _ =>
val expected = Vector(
"compile",