mirror of https://github.com/sbt/sbt.git
Merge pull request #8006 from eed3si9n/wip/run
This commit is contained in:
commit
e2acec57b7
|
|
@ -233,17 +233,16 @@ private[sbt] object MainLoop:
|
||||||
|
|
||||||
exchange.setState(cmdProgressState)
|
exchange.setState(cmdProgressState)
|
||||||
exchange.setExec(Some(exec))
|
exchange.setExec(Some(exec))
|
||||||
val (restoreTerminal, termState) = channelName.flatMap(exchange.channelForName) match {
|
val (flushTerminal, termState) = channelName.flatMap(exchange.channelForName) match
|
||||||
case Some(c) =>
|
case Some(c) =>
|
||||||
val prevTerminal = ITerminal.set(c.terminal)
|
val prevTerminal = ITerminal.set(c.terminal)
|
||||||
// temporarily set the prompt to running during task evaluation
|
// temporarily set the prompt to running during task evaluation
|
||||||
c.terminal.setPrompt(Prompt.Running)
|
c.terminal.setPrompt(Prompt.Running)
|
||||||
(() => {
|
(() => c.terminal.flush()) -> cmdProgressState.put(
|
||||||
ITerminal.set(prevTerminal)
|
Keys.terminalKey,
|
||||||
c.terminal.flush()
|
Terminal(c.terminal)
|
||||||
}) -> cmdProgressState.put(Keys.terminalKey, Terminal(c.terminal))
|
)
|
||||||
case _ => (() => ()) -> cmdProgressState.put(Keys.terminalKey, Terminal(ITerminal.get))
|
case _ => (() => ()) -> cmdProgressState.put(Keys.terminalKey, Terminal(ITerminal.get))
|
||||||
}
|
|
||||||
|
|
||||||
val currentCmdProgress =
|
val currentCmdProgress =
|
||||||
cmdProgressState.get(sbt.Keys.currentCommandProgress)
|
cmdProgressState.get(sbt.Keys.currentCommandProgress)
|
||||||
|
|
@ -279,12 +278,10 @@ private[sbt] object MainLoop:
|
||||||
currentCmdProgress
|
currentCmdProgress
|
||||||
.foreach(_.afterCommand(exec.commandLine, Left(e)))
|
.foreach(_.afterCommand(exec.commandLine, Left(e)))
|
||||||
throw e
|
throw e
|
||||||
} finally {
|
} finally
|
||||||
// Flush the terminal output after command evaluation to ensure that all output
|
// Flush the terminal output after command evaluation to ensure that all output
|
||||||
// is displayed in the thin client before we report the command status. Also
|
// is displayed in the thin client before we report the command status.
|
||||||
// set the prompt to whatever it was before we started evaluating the task.
|
flushTerminal()
|
||||||
restoreTerminal()
|
|
||||||
}
|
|
||||||
if (
|
if (
|
||||||
exec.execId.fold(true)(!_.startsWith(networkExecPrefix)) &&
|
exec.execId.fold(true)(!_.startsWith(networkExecPrefix)) &&
|
||||||
!exec.commandLine.startsWith(networkExecPrefix)
|
!exec.commandLine.startsWith(networkExecPrefix)
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import sbt.util.{ Level, Logger }
|
||||||
import scala.concurrent.ExecutionContext
|
import scala.concurrent.ExecutionContext
|
||||||
import scala.concurrent.duration.*
|
import scala.concurrent.duration.*
|
||||||
import scala.util.Try
|
import scala.util.Try
|
||||||
|
import scala.util.control.NonFatal
|
||||||
import sbt.util.LoggerContext
|
import sbt.util.LoggerContext
|
||||||
import java.util.concurrent.TimeoutException
|
import java.util.concurrent.TimeoutException
|
||||||
import xsbti.FileConverter
|
import xsbti.FileConverter
|
||||||
|
|
@ -308,6 +309,8 @@ private[sbt] abstract class AbstractBackgroundJobService extends BackgroundJobSe
|
||||||
copyClasspath(products, full, workingDirectory, hashFileContents = true, converter)
|
copyClasspath(products, full, workingDirectory, hashFileContents = true, converter)
|
||||||
|
|
||||||
private[sbt] def pauseChannelDuringJob(state: State, handle: JobHandle): Unit =
|
private[sbt] def pauseChannelDuringJob(state: State, handle: JobHandle): Unit =
|
||||||
|
if !jobs.contains(handle) then ()
|
||||||
|
else
|
||||||
currentChannel(state) match
|
currentChannel(state) match
|
||||||
case Some(channel) =>
|
case Some(channel) =>
|
||||||
handle match
|
handle match
|
||||||
|
|
@ -424,7 +427,8 @@ private[sbt] class BackgroundThreadPool extends java.io.Closeable {
|
||||||
list
|
list
|
||||||
}
|
}
|
||||||
listeners.foreach { l =>
|
listeners.foreach { l =>
|
||||||
l.executionContext.execute(() => l.callback())
|
try l.executionContext.execute(() => l.callback())
|
||||||
|
catch case NonFatal(_) => ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue