Skip to content

Commit

Permalink
Early return if Shell#profile's preferred is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
issyl0 committed Jan 22, 2025
1 parent 22a1fb9 commit d2fd233
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Library/Homebrew/utils/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ def profile
return "#{ENV["HOMEBREW_ZDOTDIR"]}/.zshrc" if ENV["HOMEBREW_ZDOTDIR"].present?
end

SHELL_PROFILE_MAP.fetch(preferred, "~/.profile")
return "~/.profile" if (shell = preferred).nil?

SHELL_PROFILE_MAP.fetch(shell, "~/.profile")
end

sig { params(variable: String, value: String).returns(T.nilable(String)) }
Expand Down Expand Up @@ -110,7 +112,7 @@ def prepend_path_in_profile(path)
tcsh: "~/.tcshrc",
zsh: "~/.zshrc",
}.freeze,
T::Hash[T.nilable(Symbol), String],
T::Hash[Symbol, String],
)

UNSAFE_SHELL_CHAR = %r{([^A-Za-z0-9_\-.,:/@~+\n])}
Expand Down

0 comments on commit d2fd233

Please sign in to comment.