Tracker: Bugs

5 JLine does not work under Cygwin - ID: 1822900
Last Update: Comment added ( headius )

I am trying to use the HBase shell from the Hadoop project (org.apache.hadoop.hbase.Shell) which (currently) uses version 0.9.91 of JLine for command line processing.

When start the shell from a regular Windows console then the shell works fine.

But if I start the shell from Cygwin then nothing happens when I enter anything in the shell - after entering a command in the shell and pressing return nothing happens anymore.


Nobody/Anonymous ( nobody ) - 2007-10-30 10:05:12 PDT

5

Open

None

Nobody/Anonymous

None

None

Public


Comments ( 4 )

Date: 2010-05-13 07:02:01 PDT
Sender: headiusProject Admin

There are some tweaks required when running under cygwin. See
http://jira.codehaus.org/browse/JRUBY-2675

Perhaps there's a change we could make in Jline to be smarter about this?


Date: 2008-09-30 07:46:23 PDT
Sender: nobody

For a workaround to this problem, set system property "jline.terminal" to
"jline.UnsupportedTerminal" before calling ConsoleReader constructor. It
works for me in MiGW.



Date: 2008-09-30 07:43:17 PDT
Sender: nobody

Method Terminal.setupTerminal contains a bug, where it compares system
property "os.name" with "windows". In Vista, os.name="Windows Vista", and
JLine wrongly assumes a UnixTerminal for ConsoleReader instances. I suggest
using a RegEx, like os_name.matches("^[Ww]indows.*), to check OS type.

Anyway, even after fixing this bug JLine does not work in Cygwin (nor
MinGW).



Date: 2008-04-07 07:59:06 PDT
Sender: weiqigao


Here's a workaround (for Cygwin + xterm, JLine worked fine for me on Cygwin
+ bash):

#!/bin/bash
#
# Run Your App
#
stty -icanon min 1 -echo
java -Djline.terminal=jline.UnixTerminal jline.ConsoleRunner your.App "$@"
stty icanon echo

We have to use the UnixTerminal class because Cygwin + xterm is essentially
a Unix style terminal. The jline.UnixTerminal class attempts to execute
the commands "stty -icanon min 1" and "stty -echo" on start up and restores
the tty to its original setting on exit. However, probably because the
Windows version of the JDK knows nothing about Cygwin, these exec-ed
commands does not affect the current terminal. Executing these commands
outside the Java program helps to prep the tty for JLine interactive mode.

Without the two stty commands, JLine would still perform the commands
logically. But you won't see the full effect until you press the Enter
key. Works out OK if you close your eyes. :)


Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.