diff options
Diffstat (limited to 'stage1/Stage1Lib.scala')
-rw-r--r-- | stage1/Stage1Lib.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala index 9e500a3..a1688c1 100644 --- a/stage1/Stage1Lib.scala +++ b/stage1/Stage1Lib.scala @@ -45,8 +45,8 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{ val hex = new java.math.BigInteger(1, array).toString(16) ("0" * (padTo-hex.size)) ++ hex } - def md5( bytes: Array[Byte] ): String = array2hex(32, MessageDigest.getInstance("MD5").digest(bytes)) - def sha1( bytes: Array[Byte] ): String = array2hex(40, MessageDigest.getInstance("SHA-1").digest(bytes)) + def md5( bytes: Array[Byte] ): String = array2hex(32, MessageDigest.getInstance("MD5").digest(bytes)).toUpperCase + def sha1( bytes: Array[Byte] ): String = array2hex(40, MessageDigest.getInstance("SHA-1").digest(bytes)).toUpperCase def red(string: String) = scala.Console.RED++string++scala.Console.RESET def blue(string: String) = scala.Console.BLUE++string++scala.Console.RESET @@ -76,7 +76,7 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{ } sha1.foreach{ hash => - val expected = hash + val expected = hash.toUpperCase val actual = this.sha1(Files.readAllBytes(incomplete)) assert( expected == actual, s"$expected == $actual" ) logger.resolver( green("verified") ++ " checksum for " ++ target.string) @@ -251,14 +251,16 @@ ${files.sorted.mkString(" \\\n")} } def trapExitCode( code: => ExitCode ): ExitCode = { + val trapExitCodeBefore = NailgunLauncher.trapExitCode.get try{ - System.setSecurityManager( new TrapSecurityManager ) + NailgunLauncher.trapExitCode.set(true) code } catch { case CatchTrappedExitCode(exitCode) => + logger.stage1(s"caught exit code $exitCode") exitCode } finally { - System.setSecurityManager(NailgunLauncher.defaultSecurityManager) + NailgunLauncher.trapExitCode.set(trapExitCodeBefore) } } |