Term: Add a fallback to ps.

This commit is contained in:
Dylan Araps 2016-10-29 16:02:24 +11:00
parent 3618a4a107
commit ec0ed23d11

View file

@ -1452,10 +1452,15 @@ getterm() {
name="${name/*\/}" name="${name/*\/}"
;; ;;
*) "Linux")
parent="$(grep -F "PPid:" "/proc/${1:-$PPID}/status")" parent="$(grep -F "PPid:" "/proc/${1:-$PPID}/status")"
name="$(< "/proc/${parent/PPid:[[:space:]]}/comm")" name="$(< "/proc/${parent/PPid:[[:space:]]}/comm")"
;; ;;
*)
parent="$(ps -p ${1:-$PPID} -o ppid=)"
name="$(ps -p $parent -o comm=)"
;;
esac esac
case "${name// }" in case "${name// }" in