Skip to content

Commit b36f319

Browse files
vasilmkdKordyjan
authored andcommitted
Add scaladoc documentation for ReplDriver#redirectOutput
1 parent 805c49f commit b36f319

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

compiler/src/dotty/tools/repl/ReplDriver.scala

+11
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,17 @@ class ReplDriver(settings: Array[String],
187187
// TODO: i5069
188188
final def bind(name: String, value: Any)(using state: State): State = state
189189

190+
/**
191+
* Controls whether the `System.out` and `System.err` streams are set to the provided constructor parameter instance
192+
* of [[java.io.PrintStream]] during the execution of the repl. On by default.
193+
*
194+
* Disabling this can be beneficial when executing a repl instance inside a concurrent environment, for example a
195+
* thread pool (such as the Scala compile server in the Scala Plugin for IntelliJ IDEA).
196+
*
197+
* In such environments, indepently executing `System.setOut` and `System.setErr` without any synchronization can
198+
* lead to unpredictable results when restoring the original streams (dependent on the order of execution), leaving
199+
* the Java process in an inconsistent state.
200+
*/
190201
protected def redirectOutput: Boolean = true
191202

192203
// redirecting the output allows us to test `println` in scripted tests

0 commit comments

Comments
 (0)