diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2017-02-20 14:18:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-20 14:18:48 +0100 |
commit | 144f7e0097f0e9fdea046df17ea7d8dd8c04db87 (patch) | |
tree | 45a7e1176c60eaa431428542652a25b037c3d3c4 /src/compiler | |
parent | 2fec08b02a5b1c27dc7e41a7b72dbb112e042d06 (diff) | |
parent | 640c85e08af30de0c491474fb397a3f2034db855 (diff) | |
download | scala-144f7e0097f0e9fdea046df17ea7d8dd8c04db87.tar.gz scala-144f7e0097f0e9fdea046df17ea7d8dd8c04db87.tar.bz2 scala-144f7e0097f0e9fdea046df17ea7d8dd8c04db87.zip |
Merge pull request #5714 from dragos/issue/usage-sterr-SI-10178
SI-10178 Route reporter.echo to stdout
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala index 99263bf834..f1f5f37c36 100644 --- a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala @@ -14,8 +14,10 @@ import StringOps.{countElementsAsString => countAs, trimAllTrailingSpace => trim /** This class implements a Reporter that displays messages on a text console. */ -class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: PrintWriter) extends AbstractReporter { - def this(settings: Settings) = this(settings, Console.in, new PrintWriter(Console.err, true)) +class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: PrintWriter, echoWriter: PrintWriter) extends AbstractReporter { + def this(settings: Settings) = this(settings, Console.in, new PrintWriter(Console.err, true), new PrintWriter(Console.out, true)) + def this(settings: Settings, reader: BufferedReader, writer: PrintWriter) = + this(settings, reader, writer, writer) /** Whether a short file name should be displayed before errors */ var shortname: Boolean = false @@ -41,6 +43,12 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr writer.flush() } + /** Prints the message to the echoWriter, which is usually stdout. */ + override def echo(msg: String): Unit = { + echoWriter.println(trimTrailing(msg)) + echoWriter.flush() + } + /** Prints the message with the given position indication. */ def printMessage(posIn: Position, msg: String): Unit = printMessage(formatMessage(posIn, msg, shortname)) |