cygwin / vista中sbt的两个问题

发布于 2024-10-08 17:36:20 字数 673 浏览 0 评论 0原文

我在 Windows Vista 上使用 cygwin 1.77。 我在 shell 中遇到 sbt 的输出问题。 一些相关的环境变量:

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

(1) 当我输入 sbt test 时,shell 包含很多不可打印的字符:

“替代文本”

我该如何解决这个问题?

我的 sbt shell 脚本如下所示:

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 文件夹中,它就会起作用。

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:

alt text

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏末 2024-10-15 17:36:20

关于 1):

Cygwin 控制台的工作方式是 Cygwin DLL 的一部分将 Unix 终端控制序列映射到 Windows 控制台 API 调用。由于该终端仿真是 Cygwin DLL 的一部分,因此它不可用于非 Cygwin 程序(例如 Java 运行时)。相反,java 将直接与 Windows 控制台对话,而 Windows 控制台不理解转义序列。因此它们直接出现在屏幕上。

有几种方法可以解决这个问题:

  • 告诉 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 的程序为代价。

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文