-
Notifications
You must be signed in to change notification settings - Fork 928
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
sbt console fails to load terminal - Invalid terminal type: jline.UnixTerminal #562
Comments
Just to note, this is still a problem in 0.12.2. |
im having this issue also... is there at least any workaround? |
I haven't found one I like I'm afraid. You can run sbt under DOS. I tried finding a way to pass -Djline.terminal=scala.tools.jline.UnixTerminal through to console but couldn't get that to work. |
can we get anyone to look at this? surely it would make it nicer for everyone if sbt worked in cygwin |
Sorry, I've been fighting this for a long time. It's actually a pretty annoying problem with various versions of jline. We're paying attention and trying to fix this, but having issues. |
Ok, I think I have a fix for the MSI, but I'm having issues using cygwin/terminal with the BACKSPACE button getting destroyed in the REPL. Still some kind of odd jline/jansi versioning madness. |
Thanks Josh - if you want someone to test this let me know which build is in and I'll give it a spin. |
FYI - sbt/sbt-launcher-package#47 That's the result of my morning's debugging. Hopefully I can hammer some more in here. |
Possibly fixed by 1a3ea6f. Verification pending. |
gents im just an sbt user how can i try this fix/file as i cannot even find Launch.scala in my installation? |
Launch.scala is an sbt source file. You can either build sbt from source (see CONTRIBUTING) or wait for 0.13.0-RC1, which might be out later this week. |
Ok, so here's a quick analysis of the issues. FIRST -> SECOND -> THIRD -> SO for 0.12.x we really have no solution to this problem. Starting in 0.13, we'll have the scripts specify the terminal as =unix. I just verified that this works beautifully. For 0.12.x I see one of a few options:
I'm going to report the issue against Scala's code-base, and elicit some feedback on how we want to proceed. |
Note: Scala JLine bug reported: https://issues.scala-lang.org/browse/SI-7604 |
Awesome, thanks Josh. The main action items for 0.13.0-RC1 are to update the setup docs for manual setup, update the changes page to notify users of the potential for improvement by using `-Djline.terminal=unix, and make the native packages to do the right thing by default. |
Yeah, already have the patches ready for native packages, I'll work on the docs after I figure out this JANSI issue. |
The startup script should set sbt.cygwin=true if running from cygwin. This will set the terminal type properly for JLine if not already set. If sbt.cygwin=false or unset and os.name includes "windows", JAnsi is downloaded by the launcher and installed on standard out/err. The value for jline.terminal is transformed from explicit jline.X to the basic types "windows", "unix", or "none". Now that sbt uses JLine 2.0, these types are understood by both sbt's JLine and Scala's. Older Scala versions shaded the classes but not the terminal property so both couldn't be configured with a class name at the same time.
Hi guys - would one of you mind to add answer to http://stackoverflow.com/questions/17124689/i-really-would-like-sbt-and-its-console-to-work-under-cygwin-any-way-you-think-i giving the status? I was wondering which version of sbt and Scala repl will have the fix and if there any workarounds for now. Thanks! |
sbt 0.13 will have the fix, and will work with any Scala version AFAIK. The backspace will most likely still be broken. We're not sure what that issue is, but there's a fix for Scala 2.11 that may fix this issue as well. |
Thanks - that's good to know. The backspace is my primary source of pain. |
It is probably clear in the context of this bug, but that is backspace in the Scala REPL on mintty/cygwin that will be broken. Other windows terminals (that don't require UnixTerminal) should work ok, including backspace. |
Ok. Are there any other terminals for Cygwin that support cut and paste? I realize this question is out of scope for this fix :) I'm coming from Mac and Cygwin is a necessary evil. |
I'm going to try rxvt when I get back to work. |
I don't know much about windows options other than what I've done to help reproduce and fix this bug. I believe other terminals are limited in some way on earlier sbt versions, perhaps lacking color and shortcut support. |
Just as an update. Using 0.13 RC 5 on mintty/cygwin/win8 and everything works like a charm, cut'n'paste and backspace in the sbt shell and in the scala console included. Thanks all for fixing this, much appreciated. |
not for me... backspace woks in sbt now but still does nothing in the scala console |
If you're using mintty, try enabling "Backspace sends ^H" in the terminal options under Keys. If that doesn't do the trick, check that ^H is recognised as the erase character by running stty from the bash prompt. |
that did it thanks!! |
This backspace send ^H setting sounds like something that belongs in our FAQs or documentation. Would either of you mind contributing to the place you would most likely have found the information besides the bug request :) Thanks, and glad this works! |
Josh - I'm not massively github savvy so let me know if I've done that wrong. |
Added note about setting in mintty to force sending of ^H which is necessary for the scala console backspace to work when jline.UnixTerminal is set and stty erase is ^H. Additional documentation for #562.
Added note about setting in mintty to force sending of ^H which is necessary for the scala console backspace to work when jline.UnixTerminal is set and stty erase is ^H. Additional documentation for #562.
I'm running "sbt console" using 0.12.0 under cygwin on windows with scala 2.9.2, jdk 1.6.0_25.
I'm using the shell script supplied as part of the MSI, and TERM=xterm.
I get this output, and the terminal is fairly non functional (no local echo, ^D doesn't exit).
$ sbt console
Getting net.java.dev.jna jna 3.2.3 ...
:: retrieving :: org.scala-sbt#boot-jna
confs: [default]
1 artifacts copied, 0 already retrieved (838kB/125ms)
Getting org.scala-sbt sbt 0.12.0 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
40 artifacts copied, 0 already retrieved (8158kB/5419ms)
Getting Scala 2.9.2 (for sbt)...
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
4 artifacts copied, 0 already retrieved (20090kB/3389ms)
[info] Loading project definition from D:\workspace\scalaz-example-sbt\project
[info] Set current project to scalaz-example-sbt (in build file:/D:/workspace/scalaz-example-sbt/)
[info] Starting scala interpreter...
[info]
[ERROR] Failed to construct terminal; falling back to unsupportedjava.lang.IllegalArgumentException: Invalid terminal type: jline.UnixTerminal
at scala.tools.jline.TerminalFactory.create(TerminalFactory.java:83)
at scala.tools.jline.TerminalFactory.get(TerminalFactory.java:154)
at scala.tools.jline.console.ConsoleReader.(ConsoleReader.java:87)
at scala.tools.jline.console.ConsoleReader.(ConsoleReader.java:134)
at scala.tools.nsc.interpreter.JLineReader$JLineConsoleReader.(JLineReader.scala:42)
at scala.tools.nsc.interpreter.JLineReader.(JLineReader.scala:21)
at scala.tools.nsc.interpreter.ILoop.chooseReader(ILoop.scala:777)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:796)
at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:851)
at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)
at sbt.Console.console0$1(Console.scala:23)
at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)
at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)
at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)
Caused by: java.lang.ClassCastException: jline.UnixTerminal cannot be cast to scala.tools.jline.Terminal
at scala.tools.jline.TerminalFactory.create(TerminalFactory.java:80)
... 19 more
Welcome to Scala version 2.9.2 (Java HotSpot(TM) Client VM, Java 1.6.0_25).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
This seems to be an incompatibility between a jline.jar containing scala.tools.jline at ~/.sbt/boot/scala-2.9.2/lib/jline.jar and one containing plain ole jline at ~/.sbt/boot/scala-2.9.2/org.scala-sbt/sbt/0.12.0/jline-1.0.jar.
If I delete the former, I get the same as issue #504. If I wipe ~/.sbt/boot as mentioned in 504, sbt downloads it all again.
Any workaround gratefully received.
The text was updated successfully, but these errors were encountered: