i really would like sbt and its console to work under cygwin any way you think it can be done?

前端 未结 1 1524
滥情空心
滥情空心 2021-02-08 08:25

i have this issue (https://github.com/sbt/sbt/issues/562) basically when I try to get a console it says:

[ERROR] Failed to construct terminal; falling back to unsupport

1条回答
  •  遇见更好的自我
    2021-02-08 09:13

    The following works for me (mostly, see note at bottom):

    1. Use the mintty shell. I believe this is the default shell for new cygwin installs but has been included as an alternative for a while. If mintty.exe exists in your \bin folder then it's ready to use, else it can be installed through the typical cygwin package selection from the setup.exe.
    2. Open a mintty window, right click anywhere, go to Options... -> Keys, and make sure Send Backspace as ^H is checked. This will allow the REPL to correctly interpret backspaces.

    For just running the Scala REPL that should be all you need, but attempting to run sbt console can still produce that exception. To get past that, run sbt without any arguments to get to the sbt prompt. From there execute:

    eval System.setProperty("jline.terminal", "scala.tools.jline.UnixTerminal")
    

    then

    console
    

    or, as a single command (with both semi-colons being important):

    ; eval System.setProperty("jline.terminal", "scala.tools.jline.UnixTerminal") ; console
    


    From what I can tell, this is caused at least in part by the Scala REPL and the sbt prompt using incompatible versions of JLine. In particular, it looks like the Scala REPL created their own wrappers around the library and are using that while sbt is using the JLine library directly.

    Note

    One limitation that I continue to run into is that the REPL wraps at column 80 even if the shell window has more horizontal space. Not only that, but when the REPL wraps like this it overwrites the same line rather than advancing to the next, and pulling long lines from history ends up pushing the cursor above the line you're actually editing.

    0 讨论(0)
提交回复
热议问题