Skip to content

Commit d2fd233

Browse files
committed
Early return if Shell#profile's preferred is nil
1 parent 22a1fb9 commit d2fd233

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Library/Homebrew/utils/shell.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ def profile
6767
return "#{ENV["HOMEBREW_ZDOTDIR"]}/.zshrc" if ENV["HOMEBREW_ZDOTDIR"].present?
6868
end
6969

70-
SHELL_PROFILE_MAP.fetch(preferred, "~/.profile")
70+
return "~/.profile" if (shell = preferred).nil?
71+
72+
SHELL_PROFILE_MAP.fetch(shell, "~/.profile")
7173
end
7274

7375
sig { params(variable: String, value: String).returns(T.nilable(String)) }
@@ -110,7 +112,7 @@ def prepend_path_in_profile(path)
110112
tcsh: "~/.tcshrc",
111113
zsh: "~/.zshrc",
112114
}.freeze,
113-
T::Hash[T.nilable(Symbol), String],
115+
T::Hash[Symbol, String],
114116
)
115117

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

0 commit comments

Comments
 (0)