From 2d6d68fb6d828203e413fb91e5c2a5c161479eab Mon Sep 17 00:00:00 2001
From: Lex Spoon
+ * Also, this flushes the reporter's output. + *
*/ def close() { Interpreter.deleteRecursively(classfilePath) + reporter.flush() } /** A traverser that finds all mentioned identifiers, i.e. things diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala index 97a0666d6c..b257545a36 100644 --- a/src/compiler/scala/tools/nsc/Main.scala +++ b/src/compiler/scala/tools/nsc/Main.scala @@ -48,6 +48,10 @@ object Main extends AnyRef with EvalLoop { else { try { object compiler extends Global(command.settings, reporter) + if (reporter.hasErrors) { + reporter.flush() + return + } if (command.settings.resident.value) resident(compiler) else if (command.files.isEmpty) diff --git a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala index 417f80a1ca..a038959056 100644 --- a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala @@ -122,4 +122,5 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr } } + override def flush() { writer.flush() } } diff --git a/src/compiler/scala/tools/nsc/reporters/Reporter.scala b/src/compiler/scala/tools/nsc/reporters/Reporter.scala index d5ae69ca0c..5a65087a70 100644 --- a/src/compiler/scala/tools/nsc/reporters/Reporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/Reporter.scala @@ -32,6 +32,9 @@ abstract class Reporter { var cancelled: Boolean = false def hasErrors: Boolean = ERROR.count != 0 || cancelled + /** Flush all output */ + def flush() { } + protected def info0(pos: Position, msg: String, severity: Severity, force: Boolean): Unit def info(pos: Position, msg: String, force: Boolean): Unit = info0(pos, msg, INFO, force) -- cgit v1.2.3