Fix Terminal Check

This commit is contained in:
Takeya Yuki 2017-05-20 21:36:51 +09:00
parent 82687cd6bf
commit 1f510e2b32
1 changed files with 2 additions and 4 deletions

View File

@ -1640,10 +1640,9 @@ get_term() {
esac esac
# Check $PPID for terminal emulator. # Check $PPID for terminal emulator.
while [[ -z "$term" ]] || ((parent > 1)); do while [[ -z "$term" ]]; do
parent="$(get_ppid "$parent")"
name="$(get_process_name "$parent")" name="$(get_process_name "$parent")"
case "${name// }" in case "${name// }" in
"${SHELL/*\/}" | *"sh" | "tmux"* | "screen" | "su"*) ;; "${SHELL/*\/}" | *"sh" | "tmux"* | "screen" | "su"*) ;;
"login"* | *"Login"* | "init" | "(init)") term="$(tty)" ;; "login"* | *"Login"* | "init" | "(init)") term="$(tty)" ;;
@ -1651,7 +1650,6 @@ get_term() {
"gnome-terminal-") term="gnome-terminal" ;; "gnome-terminal-") term="gnome-terminal" ;;
*) term="${name##*/}" ;; *) term="${name##*/}" ;;
esac esac
break;
done done
# Log that the function was run. # Log that the function was run.