diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-06 02:58:35 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-02-06 02:58:35 +0000 |
commit | 7112c6a1c15b26eebf0c020dfee7abd30eebde2d (patch) | |
tree | 16e0369e6aa7aee5bbbf79ba3d5ceacb53084534 /lib/rubygems/installer.rb | |
parent | eb537609ba0de060c6633dc3e7dd9ba5e85c6d1b (diff) | |
download | ruby-7112c6a1c15b26eebf0c020dfee7abd30eebde2d.tar.gz |
Merge RubyGems-2.7.5 from upstream.
Please see its details: http://blog.rubygems.org/2018/02/06/2.7.5-released.html
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/installer.rb')
-rw-r--r-- | lib/rubygems/installer.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 0cbca0791b..ee5fedeb64 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -206,7 +206,7 @@ class Gem::Installer ruby_executable = false existing = nil - open generated_bin, 'rb' do |io| + File.open generated_bin, 'rb' do |io| next unless io.gets =~ /^#!/ # shebang io.gets # blankline @@ -427,7 +427,7 @@ class Gem::Installer # specifications directory. def write_spec - open spec_file, 'w' do |file| + File.open spec_file, 'w' do |file| spec.installed_by_version = Gem.rubygems_version file.puts spec.to_ruby_for_cache @@ -464,7 +464,12 @@ class Gem::Installer def generate_bin # :nodoc: return if spec.executables.nil? or spec.executables.empty? - Dir.mkdir @bin_dir unless File.exist? @bin_dir + begin + Dir.mkdir @bin_dir + rescue SystemCallError + raise unless File.directory? @bin_dir + end + raise Gem::FilePermissionError.new(@bin_dir) unless File.writable? @bin_dir spec.executables.each do |filename| @@ -863,7 +868,7 @@ TEXT build_info_file = File.join build_info_dir, "#{spec.full_name}.info" - open build_info_file, 'w' do |io| + File.open build_info_file, 'w' do |io| @build_args.each do |arg| io.puts arg end |