diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-12 22:31:05 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-19 21:04:52 -0400 |
commit | ba49574e1bf51f7fb1a9cbfe94d3b7185afbbc80 (patch) | |
tree | c8e97a8a8d2cc95969179fcf2975ba4b4113c887 | |
parent | ee7737c5648708bd841c1ef41c277a7324fd46da (diff) | |
download | cbt-ba49574e1bf51f7fb1a9cbfe94d3b7185afbbc80.tar.gz cbt-ba49574e1bf51f7fb1a9cbfe94d3b7185afbbc80.tar.bz2 cbt-ba49574e1bf51f7fb1a9cbfe94d3b7185afbbc80.zip |
Make trapExitCode pass on previous exit codes
-rw-r--r-- | stage1/Stage1Lib.scala | 8 | ||||
-rw-r--r-- | stage2/Lib.scala | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala index b76e21b..d24ba52 100644 --- a/stage1/Stage1Lib.scala +++ b/stage1/Stage1Lib.scala @@ -14,7 +14,7 @@ import javax.xml.bind.annotation.adapters.HexBinaryAdapter import scala.collection.immutable.Seq // CLI interop -case class ExitCode(code: Int) +case class ExitCode(integer: Int) object ExitCode{ val Success = ExitCode(0) val Failure = ExitCode(1) @@ -110,6 +110,7 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{ .loadClass(cls) .getMethod( "main", scala.reflect.classTag[Array[String]].runtimeClass ) .invoke( null, args.toArray.asInstanceOf[AnyRef] ) + ExitCode.Success } } @@ -187,7 +188,7 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{ files.foreach(_.setLastModified(now)) // Tell the caller that things went wrong. - System.exit(code.code) + System.exit(code.integer) } } } @@ -219,11 +220,10 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{ } } - def trapExitCode( code: => Unit ): ExitCode = { + def trapExitCode( code: => ExitCode ): ExitCode = { try{ System.setSecurityManager( trapSecurityManager ) code - ExitCode.Success } catch { case TrappedExitCode(exitCode) => exitCode diff --git a/stage2/Lib.scala b/stage2/Lib.scala index 60e7dd4..e3e1ee1 100644 --- a/stage2/Lib.scala +++ b/stage2/Lib.scala @@ -97,7 +97,6 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ "-d", apiTarget.toString ) ++ compileArgs ++ sourceFiles.map(_.toString) logger.lib("creating docs for source files "+args.mkString(", ")) - trapExitCode{ redirectOutToErr{ runMain( "scala.tools.nsc.ScalaDoc", @@ -106,7 +105,6 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{ ) } } - } val docJar = jarTarget ++ ("/"++artifactId++"-"++version++"-javadoc.jar") lib.jarFile(docJar, Vector(apiTarget)) docJar |