mirror of https://github.com/sbt/sbt.git
Fix stack traces suppressed in thin client batch mode (fixes #7322)
This commit is contained in:
parent
7218b2a1ac
commit
058a108832
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
-> helloWithoutStreams
|
||||
-> helloWithStreams
|
||||
> checkTraceLevel
|
||||
Loading…
Reference in New Issue