Fix stack traces suppressed in thin client batch mode (fixes #7322)

This commit is contained in:
bittoby 2026-04-09 20:09:47 +00:00
parent 7218b2a1ac
commit 058a108832
3 changed files with 29 additions and 1 deletions

View File

@ -1144,12 +1144,20 @@ object BuiltinCommands {
.getOpt(Keys.minForcegcInterval)
.getOrElse(GCUtil.defaultMinForcegcInterval)
val exec: Exec = getExec(s1, minGCInterval)
val isInteractive = exec.source match {
case Some(src) if src.channelName.startsWith("network") =>
exchange.channelForName(src.channelName) match {
case Some(nc: NetworkChannel) => nc.isInteractive
case _ => true
}
case _ => true
}
val newState = s1
.copy(
onFailure = Some(Exec(Shell, None)),
remainingCommands = exec +: Exec(Shell, None) +: s1.remainingCommands
)
.setInteractive(true)
.setInteractive(isInteractive)
val res =
if (exec.commandLine.trim.isEmpty) newState
else newState.clearGlobalLog

View File

@ -0,0 +1,17 @@
lazy val helloWithoutStreams = taskKey[Unit]("")
lazy val helloWithStreams = taskKey[Unit]("")
lazy val checkTraceLevel = taskKey[Unit]("")
helloWithoutStreams := {
throw new RuntimeException("boom without streams!")
}
helloWithStreams := {
val log = streams.value.log
throw new RuntimeException("boom with streams!")
}
checkTraceLevel := {
val level = traceLevel.value
assert(level != -1, s"Expected traceLevel != -1 in batch mode, but got $level")
}

View File

@ -0,0 +1,3 @@
-> helloWithoutStreams
-> helloWithStreams
> checkTraceLevel