diff --git a/run/TrapExit.scala b/run/TrapExit.scala index 720c89a56..bcd79d68a 100644 --- a/run/TrapExit.scala +++ b/run/TrapExit.scala @@ -38,7 +38,7 @@ object TrapExit code.set(1) //exceptions in the main thread cause the exit code to be 1 throw x } - val customThreadGroup = new ExitThreadGroup(new ExitHandler(Thread.getDefaultUncaughtExceptionHandler, originalThreads, code, log)) + val customThreadGroup = new ExitThreadGroup(new ExitHandler(originalThreads, code, log)) val executionThread = new Thread(customThreadGroup, "run-main") { override def run() { executeMain } } val originalSecurityManager = System.getSecurityManager @@ -168,7 +168,7 @@ object TrapExit } /** An uncaught exception handler that delegates to the original uncaught exception handler except when * the cause was a call to System.exit (which generated a SecurityException)*/ - private final class ExitHandler(originalHandler: Thread.UncaughtExceptionHandler, originalThreads: Set[Thread], codeHolder: ExitCode, log: Logger) extends Thread.UncaughtExceptionHandler + private final class ExitHandler(originalThreads: Set[Thread], codeHolder: ExitCode, log: Logger) extends Thread.UncaughtExceptionHandler { def uncaughtException(t: Thread, e: Throwable) { @@ -180,8 +180,8 @@ object TrapExit catch { case _ => + log.error("(" + t.getName + ") " + e.toString) log.trace(e) - originalHandler.uncaughtException(t, e) } } } diff --git a/sbt/src/sbt-test/run/fork/test b/sbt/src/sbt-test/run/fork/test index e586311bf..2ff82f66e 100644 --- a/sbt/src/sbt-test/run/fork/test +++ b/sbt/src/sbt-test/run/fork/test @@ -3,7 +3,7 @@ $ exists flag $ delete flag $ mkdir "forked" -> set fork :== true +> set fork := true > 'set baseDirectory in run <<= baseDirectory(_ / "forked")' > run "forked"