aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'internal/p10k.zsh')
-rwxr-xr-xinternal/p10k.zsh6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 76ad8f61..86d2c242 100755
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -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