File tree 2 files changed +12
-2
lines changed 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,13 @@ abstract class Driver extends DotClass {
50
50
process(args, initCtx)
51
51
}
52
52
53
- def main (args : Array [String ]): Unit =
53
+ def main (args : Array [String ]): Unit = {
54
+ // Preload scala.util.control.NonFatal. Otherwise, when trying to catch a StackOverflowError,
55
+ // we may try to load it but fail with another StackOverflowError and lose the original exception,
56
+ // see <https://groups.google.com/forum/#!topic/scala-user/kte6nak-zPM>.
57
+ val _ = NonFatal
54
58
sys.exit(if (process(args).hasErrors) 1 else 0 )
59
+ }
55
60
}
56
61
57
62
class FatalError (msg : String ) extends Exception
Original file line number Diff line number Diff line change @@ -152,7 +152,12 @@ trait Reporting { this: Context =>
152
152
case _ => String .valueOf(res)
153
153
}
154
154
if (printer eq config.Printers .noPrinter) op
155
- else traceIndented[T ](s " ==> $question? " , (res : Any ) => s " <== $question = ${resStr(res)}" )(op)
155
+ else {
156
+ // Avoid evaluating question multiple time, since each evaluation
157
+ // may cause some extra logging output.
158
+ val q : String = question
159
+ traceIndented[T ](s " ==> $q? " , (res : Any ) => s " <== $q = ${resStr(res)}" )(op)
160
+ }
156
161
}
157
162
158
163
def traceIndented [T ](leading : => String , trailing : Any => String )(op : => T ): T =
You can’t perform that action at this time.
0 commit comments