mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 07:10:08 +00:00
fix(systemadmin): handle error for no IPv6 route in geteip
(#11458)
This commit is contained in:
parent
657ad0523d
commit
e55e3f0f56
1 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue