2fbdfa93f942611c56bb02657a39f577bd7f0ef0

Author
Sergii Tkachenko <sergiitk@google.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(init): ensure hostname is always valid for macOS (#13171)

Diff

 1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 2index 2e885219c6489e1ab03268b7499d212b5d80645c..3e547d3583d17a870e228bad2f9f3bf86eb9e2de 100644
 3--- a/oh-my-zsh.sh
 4+++ b/oh-my-zsh.sh
 5@@ -99,8 +99,8 @@ done
 6 
 7 # Figure out the SHORT hostname
 8 if [[ "$OSTYPE" = darwin* ]]; then
 9-  # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
10-  SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
11+  # macOS's $HOST changes with dhcp, etc. Use LocalHostName if possible.
12+  SHORT_HOST=$(scutil --get LocalHostName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
13 else
14   SHORT_HOST="${HOST/.*/}"
15 fi