@@ -21,11 +21,10 @@ import scala.sys.Prop._
2121
2222import scala .tools .nsc .{GenericRunnerSettings , Settings }
2323import scala .tools .nsc .Properties .{
24- coloredOutputEnabled , envOrNone , javaVersion , javaVmName ,
24+ coloredOutputEnabled , consoleIsTerminal , envOrNone , javaVersion , javaVmName ,
2525 shellBannerString , shellInterruptedString , shellPromptString , shellWelcomeString ,
2626 userHome , versionString , versionNumberString ,
2727}
28- import scala .util .Properties .isJavaAtLeast
2928
3029object ShellConfig {
3130 val EDITOR = envOrNone(" EDITOR" )
@@ -60,15 +59,7 @@ trait ShellConfig {
6059 def batchText : String
6160 def batchMode : Boolean
6261 def doCompletion : Boolean
63- def haveInteractiveConsole : Boolean = System .console != null && consoleIsTerminal
64-
65- // false if JDK 22 and the system console says !isTerminal
66- def consoleIsTerminal : Boolean = {
67- def isTerminal : Boolean =
68- try classOf [java.io.Console ].getMethod(" isTerminal" , null ).invoke(System .console).asInstanceOf [Boolean ]
69- catch { case _ : NoSuchMethodException => false }
70- ! isJavaAtLeast(22 ) || isTerminal
71- }
62+ def haveInteractiveConsole : Boolean = consoleIsTerminal
7263
7364 // source compatibility, i.e., -Xsource
7465 def xsource : String
@@ -77,7 +68,7 @@ trait ShellConfig {
7768 private def int (name : String ) = Prop [Int ](name)
7869
7970 // This property is used in TypeDebugging. Let's recycle it.
80- val colorOk = coloredOutputEnabled && haveInteractiveConsole
71+ val colorOk = coloredOutputEnabled
8172
8273 val historyFile = s " $userHome/.scala_history_jline3 "
8374
0 commit comments