mirror of https://github.com/sbt/sbt.git
Properly emulate main thread exceptions terminating application even if other threads are running
git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@866 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
parent
b6a693be44
commit
da85255f8e
|
|
@ -30,7 +30,13 @@ object TrapExit
|
|||
val originalThreads = allThreads
|
||||
val code = new ExitCode
|
||||
val customThreadGroup = new ExitThreadGroup(new ExitHandler(Thread.getDefaultUncaughtExceptionHandler, originalThreads, code, log))
|
||||
val executionThread = new Thread(customThreadGroup, "run-main") { override def run() { execute } }
|
||||
val executionThread =
|
||||
new Thread(customThreadGroup, "run-main")
|
||||
{
|
||||
override def run(): Unit =
|
||||
try { execute }
|
||||
catch { case e => log.trace(e); System.exit(1) } // an exception in the main thread causes the whole program to terminate
|
||||
}
|
||||
|
||||
val originalSecurityManager = System.getSecurityManager
|
||||
try
|
||||
|
|
|
|||
Loading…
Reference in New Issue