diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2015-11-24 21:40:30 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2015-11-26 16:49:31 +0100 |
commit | d4e42ea4f886a1a94459d40cfc6faec3ee513fad (patch) | |
tree | 60dcdf21d43fe005d28703b632a01e2bc68b8ad9 | |
parent | bd079c7a271b4bc8007021b34de6bbacea9fa85f (diff) | |
download | dotty-d4e42ea4f886a1a94459d40cfc6faec3ee513fad.tar.gz dotty-d4e42ea4f886a1a94459d40cfc6faec3ee513fad.tar.bz2 dotty-d4e42ea4f886a1a94459d40cfc6faec3ee513fad.zip |
Preload scala.util.control.NonFatal
-rw-r--r-- | src/dotty/tools/dotc/Driver.scala | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/Driver.scala b/src/dotty/tools/dotc/Driver.scala index 3b382da58..22170a478 100644 --- a/src/dotty/tools/dotc/Driver.scala +++ b/src/dotty/tools/dotc/Driver.scala @@ -50,8 +50,13 @@ abstract class Driver extends DotClass { process(args, initCtx) } - def main(args: Array[String]): Unit = + def main(args: Array[String]): Unit = { + // Preload scala.util.control.NonFatal. Otherwise, when trying to catch a StackOverflowError, + // we may try to load it but fail with another StackOverflowError and lose the original exception, + // see <https://groups.google.com/forum/#!topic/scala-user/kte6nak-zPM>. + val _ = NonFatal sys.exit(if (process(args).hasErrors) 1 else 0) + } } class FatalError(msg: String) extends Exception |