Repository: spark
Updated Branches:
  refs/heads/branch-1.3 c88d4ab1d -> fa67877c2


[SPARK-5664][BUILD] Restore stty settings when exiting from SBT's spark-shell

For launching spark-shell from SBT.

Author: Liang-Chi Hsieh <[email protected]>

Closes #4451 from viirya/restore_stty and squashes the following commits:

fdfc480 [Liang-Chi Hsieh] Restore stty settings when exit (for launching 
spark-shell from SBT).

(cherry picked from commit dae216147f2247fd722fb0909da74fe71cf2fa8b)
Signed-off-by: Michael Armbrust <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/fa67877c
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/fa67877c
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/fa67877c

Branch: refs/heads/branch-1.3
Commit: fa67877c2323122d4ee10ea9c4175ef0473cedcc
Parents: c88d4ab
Author: Liang-Chi Hsieh <[email protected]>
Authored: Mon Feb 9 11:45:12 2015 -0800
Committer: Michael Armbrust <[email protected]>
Committed: Mon Feb 9 11:45:21 2015 -0800

----------------------------------------------------------------------
 build/sbt                 | 28 ++++++++++++++++++++++++++++
 build/sbt-launch-lib.bash |  2 +-
 2 files changed, 29 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/fa67877c/build/sbt
----------------------------------------------------------------------
diff --git a/build/sbt b/build/sbt
index 28ebb64..cc3203d 100755
--- a/build/sbt
+++ b/build/sbt
@@ -125,4 +125,32 @@ loadConfigFile() {
 [[ -f "$etc_sbt_opts_file" ]] && set -- $(loadConfigFile "$etc_sbt_opts_file") 
"$@"
 [[ -f "$sbt_opts_file" ]] && set -- $(loadConfigFile "$sbt_opts_file") "$@"
 
+exit_status=127
+saved_stty=""
+
+restoreSttySettings() {
+  stty $saved_stty
+  saved_stty=""
+}
+
+onExit() {
+  if [[ "$saved_stty" != "" ]]; then
+    restoreSttySettings
+  fi
+  exit $exit_status
+}
+
+saveSttySettings() {
+  saved_stty=$(stty -g 2>/dev/null)
+  if [[ ! $? ]]; then
+    saved_stty=""
+  fi
+}
+
+saveSttySettings
+trap onExit INT
+
 run "$@"
+
+exit_status=$?
+onExit

http://git-wip-us.apache.org/repos/asf/spark/blob/fa67877c/build/sbt-launch-lib.bash
----------------------------------------------------------------------
diff --git a/build/sbt-launch-lib.bash b/build/sbt-launch-lib.bash
index 5e0c640..504be48 100755
--- a/build/sbt-launch-lib.bash
+++ b/build/sbt-launch-lib.bash
@@ -81,7 +81,7 @@ execRunner () {
     echo ""
   }
 
-  exec "$@"
+  "$@"
 }
 
 addJava () {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to