mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-16 09:50:06 +00:00
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.
This commit is contained in:
parent
d963f10db9
commit
7f6e74f012
1 changed files with 4 additions and 2 deletions
|
@ -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…
Reference in a new issue