开发者

Two problems with sbt in cygwin / vista

开发者 https://www.devze.com 2023-01-31 06:02 出处:网络
I am using cygwin 1.77 on windows vista. I\'m facing problems with the output from sbt in the shell. Some relevant environment vars:

I am using cygwin 1.77 on windows vista. I'm facing problems with the output from sbt in the shell. Some relevant environment vars:

TERM=cygwin
CYGWIN=server
LANG=C.UTF-8

(1) When I type sbt test the开发者_开发知识库 shell contains a lot of unprintable characters:

Two problems with sbt in cygwin / vista

How can I fix this ?

My sbt shell script looks like this:

dir=`dirname $0`
stty -icanon min 1 -echo > /dev/null 2>&1
java -Djline.terminal=jline.UnixTerminal -Xmx512M -jar 
    `cygpath -w $dir`/sbt-launch-0.7.4.jar "$@"
stty icanon echo > /dev/null 2>&1

(2) The sbt command cannot find the scalatest jar & I don't know how to configure it to download it via ivy. It works if I drop the jar into the lib folder.


Regarding 1):

The way the Cygwin console works is that there's a part of the Cygwin DLL that maps Unix terminal control sequences to Windows console API calls. Since that terminal emulation is part of the Cygwin DLL, it is not available to non-Cygwin programs such as the Java runtime. Instead, java will be talking directly to the Windows console, which doesn't understand escape sequences. Hence they appear directly on screen.

There are a few ways you could address this:

  • Tell Java/Scala to use the Windows console API instead of Unix control sequences. I guess removing the -Djline.terminal=jline.UnixTerminal option would do that.
  • Set the CYGWIN=tty option. With that, programs invoked in the Cygwin console have their I/O connected to a "pseudo terminal" (pty) device instead of being connected directly to the console window. This makes the terminal emulation features available to non-Cygwin programs, but it means that programs that use the Windows console API will no longer work correctly.
  • Use one of Cygwin's other terminal emulators: mintty, xterm, rxvt(-unicode). These offer better terminal emulation and more sensible user interfaces than the default console, but again at the cost of not supporting programs that use the Windows console API.

(Btw, the CYGWIN=server option is obsolete; the feature that it enabled is always on anyway.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号