Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two problems with sbt in cygwin / vista

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.

like image 972
Frankie Ribery Avatar asked Dec 17 '10 09:12

Frankie Ribery


1 Answers

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

like image 60
ak2 Avatar answered Oct 06 '22 10:10

ak2