From 0d19edb0cc0af4848d80f4b1970685f03cffb758 Mon Sep 17 00:00:00 2001 From: Colin Jones Date: Fri, 12 Apr 2013 15:24:34 -0500 Subject: [PATCH] Handle cygwin jline issues fixes #850 --- bin/lein | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bin/lein b/bin/lein index 1836d18c..3723559d 100755 --- a/bin/lein +++ b/bin/lein @@ -190,6 +190,19 @@ fi # Support $JAVA_OPTS for backwards-compatibility. export JVM_OPTS="${JVM_OPTS:-"$JAVA_OPTS"}" +# Handle jline issue with cygwin not propagating OSTYPE through java subprocesses: https://github.com/jline/jline2/issues/62 +cygterm=false +if [ $cygwin ]; then + case "$TERM" in + rxvt* | xterm* | vt*) cygterm=true ;; + esac +fi + +if $cygterm; then + JVM_OPTS="$JVM_OPTS -Djline.terminal=jline.UnixTerminal" + stty -icanon min 1 -echo > /dev/null 2>&1 +fi + # TODO: investigate http://skife.org/java/unix/2011/06/20/really_executable_jars.html # If you're packaging this for a package manager (.deb, homebrew, etc) # you need to remove the self-install and upgrade functionality or see lein-pkg. @@ -306,6 +319,10 @@ else EXIT_CODE=$? + if $cygterm ; then + stty icanon echo > /dev/null 2>&1 + fi + if [ -r "$TRAMPOLINE_FILE" ] && [ "$LEIN_TRAMPOLINE_WARMUP" = "" ]; then TRAMPOLINE="$(cat $TRAMPOLINE_FILE)" if [ "$INPUT_CHECKSUM" = "" ]; then @@ -317,3 +334,4 @@ else fi fi fi +