Use MessageOnlyException for "Nonzero exit code"

This commit is contained in:
Eugene Yokota 2018-06-27 07:09:59 -04:00
parent 3b7e6974c3
commit 306ee82db3
2 changed files with 6 additions and 3 deletions

View File

@ -302,7 +302,7 @@ lazy val runProj = (project in file("run"))
exclude[DirectMissingMethodProblem]("sbt.OutputStrategy#LoggedOutput.copy$default$*"),
)
)
.configure(addSbtIO, addSbtUtilLogging, addSbtCompilerClasspath)
.configure(addSbtIO, addSbtUtilLogging, addSbtUtilControl, addSbtCompilerClasspath)
val sbtProjDepsCompileScopeFilter =
ScopeFilter(inDependencies(LocalProject("sbtProj"), includeRoot = false), inConfigurations(Compile))

View File

@ -12,6 +12,7 @@ import java.lang.reflect.{ Method, Modifier }
import Modifier.{ isPublic, isStatic }
import sbt.internal.inc.classpath.ClasspathUtilities
import sbt.internal.inc.ScalaInstance
import sbt.internal.util.MessageOnlyException
import sbt.io.Path
@ -29,7 +30,9 @@ class ForkRun(config: ForkOptions) extends ScalaRun {
if (exitCode == 0) Success(())
else
Failure(
new RuntimeException(s"""Nonzero exit code returned from $label: $exitCode""".stripMargin)
new MessageOnlyException(
s"""Nonzero exit code returned from $label: $exitCode""".stripMargin
)
)
val process = fork(mainClass, classpath, options, log)
def cancel() = {
@ -124,6 +127,6 @@ object Run {
if (exitCode == 0) {
log.debug("Exited with code 0")
Success(())
} else Failure(new RuntimeException("Nonzero exit code: " + exitCode))
} else Failure(new MessageOnlyException("Nonzero exit code: " + exitCode))
}
}