[SPARK-5664][BUILD] Restore stty settings when exiting from SBT's spark-shell
For launching spark-shell from SBT. Author: Liang-Chi Hsieh <viirya@gmail.com> 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).
This commit is contained in:
parent
afb131637d
commit
dae216147f
28
build/sbt
28
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
|
||||
|
|
|
@ -81,7 +81,7 @@ execRunner () {
|
|||
echo ""
|
||||
}
|
||||
|
||||
exec "$@"
|
||||
"$@"
|
||||
}
|
||||
|
||||
addJava () {
|
||||
|
|
Loading…
Reference in a new issue