Diff
1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
2index 40f13f37e078e431202b45009237c3182652d62e..137ca3b6fc149ea696f6551f6000af749ad6656f 100644
3--- a/oh-my-zsh.sh
4+++ b/oh-my-zsh.sh
5@@ -1,14 +1,14 @@
6+# ANSI formatting function (\033[<code>m)
7+# 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow
8+omz_f() {
9+ [ $# -gt 0 ] || return
10+ IFS=";" printf "\033[%sm" $*
11+}
12+# If stdout is not a terminal ignore all formatting
13+[ -t 1 ] || omz_f() { :; }
14+
15 # Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here)
16 [ -n "$ZSH_VERSION" ] || {
17- # ANSI formatting function (\033[<code>m)
18- # 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow
19- omz_f() {
20- [ $# -gt 0 ] || return
21- IFS=";" printf "\033[%sm" $*
22- }
23- # If stdout is not a terminal ignore all formatting
24- [ -t 1 ] || omz_f() { :; }
25-
26 omz_ptree() {
27 # Get process tree of the current process
28 pid=$$; pids="$pid"
29@@ -38,6 +38,15 @@
30 return 1
31 }
32
33+# Check if in emulation mode, if so early return
34+# https://github.com/ohmyzsh/ohmyzsh/issues/11686
35+[[ "$(emulate)" = zsh ]] || {
36+ printf "$(omz_f 1 31)Error:$(omz_f 22) Oh My Zsh can't be loaded in \`$(emulate)\` emulation mode.$(omz_f 0)\n" >&2
37+ return 1
38+}
39+
40+unset -f omz_f
41+
42 # If ZSH is not defined, use the current script's directory.
43 [[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}"
44