summaryrefslogtreecommitdiff
path: root/lib/bundler/settings.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/settings.rb')
-rw-r--r--lib/bundler/settings.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 1ca41e2e71..528d4f6aa2 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -224,17 +224,15 @@ module Bundler
end
def load_config(config_file)
- valid_file = config_file && config_file.exist? && !config_file.size.zero?
- if !ignore_config? && valid_file
+ SharedHelpers.filesystem_access(config_file, :read) do
+ valid_file = config_file && config_file.exist? && !config_file.size.zero?
+ return {} if ignore_config? || !valid_file
config_regex = /^(BUNDLE_.+): (['"]?)(.*(?:\n(?!BUNDLE).+)?)\2$/
- raise PermissionError.new(config_file, :read) unless config_file.readable?
config_pairs = config_file.read.scan(config_regex).map do |m|
key, _, value = m
[convert_to_backward_compatible_key(key), value.gsub(/\s+/, " ").tr('"', "'")]
end
Hash[config_pairs]
- else
- {}
end
end