Improve HOMEBREW_TEMP handling
- if HOMEBREW_TEMP is not writable, use the default temp directory - when running `brew bundle exec`, strip various temporary directories from the environment if they are not writable
This commit is contained in:
parent
f9fe0f573b
commit
dbbffbaca5
@ -104,6 +104,10 @@ HOMEBREW_CASKROOM="${HOMEBREW_PREFIX}/Caskroom"
|
||||
HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}"
|
||||
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}"
|
||||
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
|
||||
if [[ ! -w "${HOMEBREW_TEMP}" ]]
|
||||
then
|
||||
HOMEBREW_TEMP="${HOMEBREW_DEFAULT_TEMP}"
|
||||
fi
|
||||
|
||||
# commands that take a single or no arguments.
|
||||
# HOMEBREW_LIBRARY set by bin/brew
|
||||
|
||||
@ -111,6 +111,14 @@ module Homebrew
|
||||
# For commands which aren't either absolute or relative
|
||||
raise "command was not found in your PATH: #{command}" if command.exclude?("/") && which(command).nil?
|
||||
|
||||
%w[HOMEBREW_TEMP TMPDIR HOMEBREW_TMPDIR].each do |var|
|
||||
value = ENV.fetch(var, nil)
|
||||
next if value.blank?
|
||||
next if File.writable?(value)
|
||||
|
||||
ENV.delete(var)
|
||||
end
|
||||
|
||||
if subcommand == "env"
|
||||
ENV.sort.each do |key, value|
|
||||
# No need to export empty values.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user