getterm: Use /proc/$PPID/comm instead of ps

This commit is contained in:
Dylan Araps 2016-10-29 15:19:04 +11:00
parent 41c778f680
commit a06329db1b

View file

@ -1453,8 +1453,8 @@ getterm() {
;;
*)
parent="$(ps -p ${1:-$PPID} -o ppid=)"
name="$(ps -p $parent -o comm=)"
parent="$(grep -F "PPid:" "/proc/${1:-$PPID}/status")"
name="$(< "/proc/${parent/PPid:[[:space:]]}/comm")"
;;
esac