summaryrefslogtreecommitdiff
path: root/plugins/systemadmin
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-03-18 16:23:39 -0700
committerTuowen Zhao <ztuowen@gmail.com>2023-03-18 16:23:39 -0700
commit4b0bbc0b263a150eb9a9b59f196914629be06a9b (patch)
tree619723cfa449f93149b766ee397f85ce2acef5f7 /plugins/systemadmin
parentdb7efd2336e4dbe6abf321b00dbc11bc5afb1355 (diff)
parent72732a224e886933df6b64a49ec6f5e94c884612 (diff)
downloadzsh-4b0bbc0b263a150eb9a9b59f196914629be06a9b.tar.gz
zsh-4b0bbc0b263a150eb9a9b59f196914629be06a9b.tar.bz2
zsh-4b0bbc0b263a150eb9a9b59f196914629be06a9b.zip
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'plugins/systemadmin')
-rw-r--r--plugins/systemadmin/systemadmin.plugin.zsh8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
index 9b5159ff1..7ce62bac1 100644
--- a/plugins/systemadmin/systemadmin.plugin.zsh
+++ b/plugins/systemadmin/systemadmin.plugin.zsh
@@ -140,7 +140,13 @@ function d0() {
# gather external ip address
function geteip() {
curl -s -S -4 https://icanhazip.com
- curl -s -S -6 https://icanhazip.com
+
+ # handle case when there is no IPv6 external IP, which shows error
+ # curl: (7) Couldn't connect to server
+ curl -s -S -6 https://icanhazip.com 2>/dev/null
+ local ret=$?
+ (( ret == 7 )) && print -P -u2 "%F{red}error: no IPv6 route to host%f"
+ return $ret
}
# determine local IP address(es)