Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix ZDOTDIR environment variable not being read #17483

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/Homebrew/test/utils/shell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

it "returns /tmp/.zshrc for Zsh if ZDOTDIR is /tmp" do
ENV["SHELL"] = "/bin/zsh"
ENV["ZDOTDIR"] = "/tmp"
ENV["HOMEBREW_ZDOTDIR"] = "/tmp"
expect(described_class.profile).to eq("/tmp/.zshrc")
end

it "returns ~/.zshrc for Zsh" do
ENV["SHELL"] = "/bin/zsh"
ENV["ZDOTDIR"] = nil
ENV["HOMEBREW_ZDOTDIR"] = nil
expect(described_class.profile).to eq("~/.zshrc")
end

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/utils/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def profile
rc_profile = "#{Dir.home}/.rcrc"
return rc_profile if File.exist? rc_profile
when :zsh
return "#{ENV["ZDOTDIR"]}/.zshrc" if ENV["ZDOTDIR"].present?
return "#{ENV["HOMEBREW_ZDOTDIR"]}/.zshrc" if ENV["HOMEBREW_ZDOTDIR"].present?
end

SHELL_PROFILE_MAP.fetch(preferred, "~/.profile")
Expand Down
1 change: 1 addition & 0 deletions bin/brew
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ USED_BY_HOMEBREW_VARS=(
TMUX
XDG_CACHE_HOME
XDG_RUNTIME_DIR
ZDOTDIR
)
for VAR in "${USED_BY_HOMEBREW_VARS[@]}"
do
Expand Down
Loading