Description
Scala 3.0.0-RC2. A command like the following:
$ scala <<EOF
:load somestuff.scala
EOF
or trying:
$ echo ":load src/script/scala/progscala3/hierarchy/Asserts.scala" | scala
Both cause this exception:
Exception in thread "main" java.lang.IllegalStateException: Unable to create a system terminal
at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:323)
at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:265)
at dotty.tools.repl.JLineTerminal.<init>(JLineTerminal.scala:23)
at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:123)
at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:114)
at dotty.tools.repl.Main$.main(Main.scala:6)
at dotty.tools.repl.Main.main(Main.scala)
This is fairly well known issue, see for example https://youtrack.jetbrains.com/issue/IDEA-183619. I attempted to use the recommended fix, setting the property -Dorg.jline.terminal.dumb=true
. I did this by passing the argument -J-Dorg.jline.terminal.dumb=true
to the REPL, even though this argument is not documented for the REPL in the -help
output. It appeared to be ignored or do nothing. I also tried setting the environment variable JAVA_OPTS=-Dorg.jline.terminal.dumb=true
before starting the REPL, but that didn't work either. Finally, I even tried setting the property inside the REPL, i.e.,
$ scala <<EOF
System.setProperty("...", "...")
:load somestuff.scala
EOF
I would expect this to be too late. It also doesn't help.
Note that in the Scala 2.13 REPL, without setting the property, you get a warning that it will default to a dumb terminal, but otherwise appears to work fine.