diff options
author | Josh Rosen <joshrosen@apache.org> | 2013-12-15 18:39:30 -0800 |
---|---|---|
committer | Josh Rosen <joshrosen@apache.org> | 2013-12-15 18:51:31 -0800 |
commit | f8ba89da217a1f1fd5c856a95a27a3e535017643 (patch) | |
tree | 746c7e73e63aed04303a3c17da64ccde959b6366 /spark-shell | |
parent | d2ced6d58c5e8aea23f909c2fc4ac11aa1b55607 (diff) | |
download | spark-f8ba89da217a1f1fd5c856a95a27a3e535017643.tar.gz spark-f8ba89da217a1f1fd5c856a95a27a3e535017643.tar.bz2 spark-f8ba89da217a1f1fd5c856a95a27a3e535017643.zip |
Fix Cygwin support in several scripts.
This allows the spark-shell, spark-class, run-example, make-distribution.sh,
and ./bin/start-* scripts to work under Cygwin. Note that this doesn't
support PySpark under Cygwin, since that requires many additional `cygpath`
calls from within Python and will be non-trivial to implement.
This PR was inspired by, and subsumes, #253 (so close #253 after this is merged).
Diffstat (limited to 'spark-shell')
-rwxr-xr-x | spark-shell | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/spark-shell b/spark-shell index 9608bd3f30..d20af0fb39 100755 --- a/spark-shell +++ b/spark-shell @@ -23,7 +23,11 @@ # if those two env vars are set in spark-env.sh but MASTER is not. # Options: # -c <cores> Set the number of cores for REPL to use -# + +cygwin=false +case "`uname`" in + CYGWIN*) cygwin=true;; +esac # Enter posix mode for bash set -o posix @@ -79,7 +83,18 @@ if [[ ! $? ]]; then saved_stty="" fi -$FWDIR/spark-class $OPTIONS org.apache.spark.repl.Main "$@" +if $cygwin; then + # Workaround for issue involving JLine and Cygwin + # (see http://sourceforge.net/p/jline/bugs/40/). + # If you're using the Mintty terminal emulator in Cygwin, may need to set the + # "Backspace sends ^H" setting in "Keys" section of the Mintty options + # (see https://github.com/sbt/sbt/issues/562). + stty -icanon min 1 -echo > /dev/null 2>&1 + $FWDIR/spark-class -Djline.terminal=unix $OPTIONS org.apache.spark.repl.Main "$@" + stty icanon echo > /dev/null 2>&1 +else + $FWDIR/spark-class $OPTIONS org.apache.spark.repl.Main "$@" +fi # record the exit status lest it be overwritten: # then reenable echo and propagate the code. |