From 7f6e74f0126d8bd57070944c5595f9c30db8aae5 Mon Sep 17 00:00:00 2001 From: romkatv Date: Mon, 29 Jul 2019 10:07:42 +0200 Subject: [PATCH] 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. --- internal/p10k.zsh | 6 ++++-- 1 file 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="$()* ]] || return + free_bytes=$(( $match[1] * 1024 )) ;; esac