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

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

问题描述

我在 windows vista 上使用 cygwin 1.77.我在 shell 中遇到了 sbt 的输出问题.一些相关的环境变量:

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) 当我输入 sbt test 时,shell 包含很多不可打印的字符:

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

我该如何解决这个问题?

How can I fix this ?

我的 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.

(顺便说一句,CYGWIN=server 选项已过时;它启用的功能始终处于启用状态.)

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

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

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