-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JLine error when attempting to run the REPL with piped input #11978
Comments
These incantations using
But we should probably gracefully fall back to a dumb terminal like Scala 2 does, as was also suggested here. |
I just noticed in #11707 that using |
Interesting that without |
#19744 may fixe this |
Sadly, this is still broken, even on the new echo 'object Example { def smth = "smth" }' |scala-cli repl _
# Compiling project (Scala 3.4.2, JVM (17))
# Compiled project (Scala 3.4.2, JVM (17))
# Exception in thread "main" java.lang.IllegalStateException: Unable to create a terminal
# at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:394)
# at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:362)
# at dotty.tools.repl.JLineTerminal.<init>(JLineTerminal.scala:25)
# at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:145)
# at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:136)
# at dotty.tools.repl.Main$.main(Main.scala:7)
# at dotty.tools.repl.Main.main(Main.scala)
# Suppressed: java.io.IOException: Unable to find terminal provider ffm
# at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74)
# at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:667)
# at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:632)
# at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395)
# ... 6 more
# Suppressed: java.io.IOException: Unable to find terminal provider jni
# at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74)
# at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:667)
# at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:634)
# at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395)
# ... 6 more
# Suppressed: java.io.IOException: Unable to find terminal provider jansi
# at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74)
# at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:667)
# at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:636)
# at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395)
# ... 6 more
# Suppressed: java.io.IOException: Unable to load terminal provider jna: null
# at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:71)
# at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:667)
# at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:638)
# at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395)
# ... 6 more
# Caused by: java.lang.reflect.InvocationTargetException
# at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
# at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
# at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
# at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
# at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
# at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:69)
# ... 9 more
# Caused by: java.lang.UnsupportedOperationException: Unsupported platform mac-aarch64
# at org.jline.terminal.impl.jna.JnaNativePty.isatty(JnaNativePty.java:194)
# at org.jline.terminal.impl.jna.JnaNativePty.isPosixSystemStream(JnaNativePty.java:170)
# at org.jline.terminal.impl.jna.JnaTerminalProvider.checkSystemStream(JnaTerminalProvider.java:124)
# at org.jline.terminal.impl.jna.JnaTerminalProvider.<init>(JnaTerminalProvider.java:31)
# ... 15 more |
Reading #11707 it seems to me that the right thing to do here might just be to keep the default value of |
Set the `dumb` JLine option to `null` instead of `false` when a dumb terminal is not forced. This allows JLine to fall back to a dumb terminal if needed. Fixes #11978. Before: ``` ➜ ~/dotty git:(mb/11978) ✗ echo 'object Example { def smth = "smth" }' | bin/scala The `--offline` option is experimental Please bear in mind that non-ideal user experience should be expected. If you encounter any bugs or have feedback to share, make sure to reach out to the maintenance team at https://github.com/VirtusLab/scala-cli Exception in thread "main" java.lang.IllegalStateException: Unable to create a terminal at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:394) at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:362) at dotty.tools.repl.JLineTerminal.<init>(JLineTerminal.scala:34) at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:145) at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:136) at dotty.tools.repl.Main$.main(Main.scala:7) at dotty.tools.repl.Main.main(Main.scala) Suppressed: java.io.IOException: Unable to find terminal provider ffm at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74) at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:667) at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:632) at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395) ... 6 more Suppressed: java.io.IOException: Unable to find terminal provider jni at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74) at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:667) at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:634) at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395) ... 6 more Suppressed: java.io.IOException: Unable to find terminal provider jansi at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74) at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:667) at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:636) at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395) ... 6 more ``` After: ``` ➜ ~/dotty git:(mb/11978) echo 'object Example { def smth = "smth" }' | bin/scala The `--offline` option is experimental Please bear in mind that non-ideal user experience should be expected. If you encounter any bugs or have feedback to share, make sure to reach out to the maintenance team at https://github.com/VirtusLab/scala-cli Aug 05, 2024 3:53:49 PM org.jline.utils.Log logr WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information) Welcome to Scala 3.6.0-RC1-bin-SNAPSHOT-git-dce4377 (17.0.8, Java OpenJDK 64-Bit Server VM). Type in expressions for evaluation. Or try :help. scala> // defined object Example scala> % ➜ ~/dotty ```
Scala 3.0.0-RC2. A command like the following:
or trying:
Both cause this exception:
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 variableJAVA_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.,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.
The text was updated successfully, but these errors were encountered: