Don't show ram prompt if /proc/meminfo lists not-a-number for MemAvailable.

I've never encountered the case where this commit makes a difference
but it's possible that #136 will get fixed.
pull/141/head
romkatv 5 years ago
parent d963f10db9
commit 7f6e74f012

@ -1956,8 +1956,10 @@ prompt_ram() {
free_bytes=${${(A)=stat}[4]}
;;
*)
local stat && stat=$(grep -F MemAvailable /proc/meminfo 2>/dev/null) || return
free_bytes=$(( ${${(A)=stat}[2]} * 1024 ))
[[ -r /proc/meminfo ]] || return
local stat && stat="$(</proc/meminfo)" || return
[[ $stat == (#b)*'MemAvailable:'[[:space:]]#(<->)* ]] || return
free_bytes=$(( $match[1] * 1024 ))
;;
esac

Loading…
Cancel
Save