summaryrefslogtreecommitdiff
path: root/lib/rubygems/remote_fetcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/remote_fetcher.rb')
-rw-r--r--lib/rubygems/remote_fetcher.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index 5a0898f084..cab2a4b0fe 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -124,7 +124,11 @@ class Gem::RemoteFetcher
local_gem_path = File.join cache_dir, gem_file_name
require "fileutils"
- FileUtils.mkdir_p cache_dir rescue nil unless File.exist? cache_dir
+ begin
+ FileUtils.mkdir_p cache_dir
+ rescue
+ nil
+ end unless File.exist? cache_dir
source_uri = Gem::Uri.new(source_uri)
@@ -280,7 +284,11 @@ class Gem::RemoteFetcher
# passes the data.
def cache_update_path(uri, path = nil, update = true)
- mtime = path && File.stat(path).mtime rescue nil
+ mtime = begin
+ path && File.stat(path).mtime
+ rescue
+ nil
+ end
data = fetch_path(uri, mtime)