cygwin / vista中的sbt的两个问题 [英] Two problems with sbt in cygwin / vista

查看:376
本文介绍了cygwin / vista中的sbt的两个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在windows vista上使用cygwin 1.77。
我在shell中输出 sbt 时遇到问题。
一些相关环境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

当输入 sbt test shell包含大量不可打印的字符:

(1) When I type sbt test the shell contains a lot of unprintable characters:

如何解决这个问题?

我的sbt shell脚本如下:

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) sbt 命令找不到 scalatest jar&我不知道如何配置它通过ivy下载。如果我把jar放到 lib 文件夹中,它会工作。

(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.

推荐答案

关于1):

Cygwin控制台的工作方式是,有一部分Cygwin DLL将Unix终端控制序列映射到Windows控制台API调用。由于终端仿真是Cygwin DLL的一部分,因此它不适用于非Cygwin程序,如Java运行时。相反, java 将直接与Windows控制台通信,这不会理解转义序列。因此,它们直接显示在屏幕上。

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:


  • 告诉Java / Scala使用Windows控制台API而不是Unix控制序列。我想删除 -Djline.terminal = jline.UnixTerminal 选项会这样做。

  • 设置 CYGWIN = tty 选项。因此,Cygwin控制台中调用的程序的I / O连接到伪终端(pty)设备,而不是直接连接到控制台窗口。这使得终端仿真功能可用于非Cygwin程序,但这意味着使用Windows控制台API的程序将无法正常工作。

  • 使用Cygwin的其他终端仿真器之一:mintty ,xterm,rxvt(-unicode)。这些提供了比默认控制台更好的终端仿真和更明智的用户界面,但是再次以不支持使用Windows控制台API的程序为代价。

  • 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, CYGWIN = server 选项已过时;其启用的功能始终处于)

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

这篇关于cygwin / vista中的sbt的两个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆