Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
30f0d591
Unverified
Commit
30f0d591
authored
Sep 04, 2023
by
Marc Cornellà
Committed by
GitHub
Sep 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(init): exit gracefully if on non-zsh emulation mode (#11874)
Fixes #11686
parent
1abc1d99
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
oh-my-zsh.sh
oh-my-zsh.sh
+17
-8
No files found.
oh-my-zsh.sh
View file @
30f0d591
# Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here)
[
-n
"
$ZSH_VERSION
"
]
||
{
# ANSI formatting function (\033[<code>m)
# 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow
omz_f
()
{
# ANSI formatting function (\033[<code>m)
# 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow
omz_f
()
{
[
$#
-gt
0
]
||
return
IFS
=
";"
printf
"
\0
33[%sm"
$*
}
# If stdout is not a terminal ignore all formatting
[
-t
1
]
||
omz_f
()
{
:
;
}
}
# If stdout is not a terminal ignore all formatting
[
-t
1
]
||
omz_f
()
{
:
;
}
# Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here)
[
-n
"
$ZSH_VERSION
"
]
||
{
omz_ptree
()
{
# Get process tree of the current process
pid
=
$$
;
pids
=
"
$pid
"
...
...
@@ -38,6 +38,15 @@
return
1
}
# Check if in emulation mode, if so early return
# https://github.com/ohmyzsh/ohmyzsh/issues/11686
[[
"
$(
emulate
)
"
=
zsh
]]
||
{
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
return
1
}
unset
-f
omz_f
# If ZSH is not defined, use the current script's directory.
[[
-z
"
$ZSH
"
]]
&&
export
ZSH
=
"
${${
(%)
:-
%x
}
:a:h
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment