summaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh37
1 files changed, 21 insertions, 16 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index e2a98408..912a990e 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -4154,22 +4154,27 @@ function _p9k_fetch_nordvpn_status() {
>&$fd echo -nE - $'PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n\0\0\0\4\1\0\0\0\0\0\0N\1\4\0\0\0\1\203\206E\221bA\226\223\325\\k\337\31i=LnH\323j?A\223\266\243y\270\303\fYmLT{$\357]R.\203\223\257_\213\35u\320b\r&=LMedz\212\232\312\310\264\307`+\210K\203@\2te\206M\2035\5\261\37\0\0\5\0\1\0\0\0\1\0\0\0\0\0'
local tag len val
local -i n
- IFS='' read -t 0.25 -r tag <&3
- tag=$'\015'
- while true; do
- tag=$((#tag))
- (( (tag >>= 3) && tag <= $#__p9k_nordvpn_tag )) || break
- tag=$__p9k_nordvpn_tag[tag]
- sysread -c n -s 1 -t 0.25 len <&3
- len=$((#len))
- val=
- (( ! len )) || {
- sysread -c n -s $len -t 0.25 val <&3
- (( n == len ))
- }
- typeset -g $tag=$val
- sysread -c n -s 1 -t 0.25 tag <&3
- done
+ {
+ IFS='' read -t 0.25 -r tag
+ tag=$'\015'
+ while true; do
+ tag=$((#tag))
+ (( (tag >>= 3) && tag <= $#__p9k_nordvpn_tag )) || break
+ tag=$__p9k_nordvpn_tag[tag]
+ [[ -t $fd ]] || true
+ sysread -c n -s 1 -t 0.25 len
+ len=$((#len))
+ val=
+ (( ! len )) || {
+ [[ -t $fd ]] || true
+ sysread -c n -s $len -t 0.25 val
+ (( n == len ))
+ }
+ typeset -g $tag=$val
+ [[ -t $fd ]] || true
+ sysread -c n -s 1 -t 0.25 tag
+ done
+ } <&$fd
} always {
exec {fd}>&-
}