diagnostic: don't expand tildes in cask env vars

We double quote them so they don't get expanded. Also, use `sh_quote` to
quote the variable values properly.
This commit is contained in:
Ruoyu Zhong 2025-08-19 16:42:01 +08:00
parent 31598ca8ef
commit 1eb070e257
No known key found for this signature in database

View File

@ -1076,8 +1076,7 @@ module Homebrew
cask_environment_variables = (locale_variables + environment_variables).sort.filter_map do |var|
next unless ENV.key?(var)
var = %Q(#{var}="#{ENV.fetch(var)}")
user_tilde(var)
%Q(#{var}="#{Utils::Shell.sh_quote(ENV.fetch(var))}")
end
add_info "Cask Environment Variables:", cask_environment_variables