mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Ignore Errno::EROFS
errors when creating bundler.lock
Apparently old versions of MacOS would set `GEM_HOME` to a `/System` folder, and trying to create a file there raises `Errno::EROFS`. We ignore the error. Any permission issues should be better handled further down the line. https://github.com/rubygems/rubygems/commit/ef90c071d0
This commit is contained in:
parent
373dabe00a
commit
08b82e6b40
2 changed files with 12 additions and 1 deletions
|
@ -12,7 +12,7 @@ module Bundler
|
||||||
yield
|
yield
|
||||||
f.flock(File::LOCK_UN)
|
f.flock(File::LOCK_UN)
|
||||||
end
|
end
|
||||||
rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP, Errno::EPERM
|
rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP, Errno::EPERM, Errno::EROFS
|
||||||
# In the case the user does not have access to
|
# In the case the user does not have access to
|
||||||
# create the lock file or is using NFS where
|
# create the lock file or is using NFS where
|
||||||
# locks are not available we skip locking.
|
# locks are not available we skip locking.
|
||||||
|
|
|
@ -42,5 +42,16 @@ RSpec.describe "process lock spec" do
|
||||||
expect(processed).to eq true
|
expect(processed).to eq true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when creating a lock raises Errno::EROFS" do
|
||||||
|
before { allow(File).to receive(:open).and_raise(Errno::EROFS) }
|
||||||
|
|
||||||
|
it "skips creating the lock file and yields" do
|
||||||
|
processed = false
|
||||||
|
Bundler::ProcessLock.lock(default_bundle_path) { processed = true }
|
||||||
|
|
||||||
|
expect(processed).to eq true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue