summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/process_lock.rb2
-rw-r--r--spec/bundler/install/process_lock_spec.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/bundler/process_lock.rb b/lib/bundler/process_lock.rb
index a5cc614e20..af7cd8a05f 100644
--- a/lib/bundler/process_lock.rb
+++ b/lib/bundler/process_lock.rb
@@ -12,7 +12,7 @@ module Bundler
yield
f.flock(File::LOCK_UN)
end
- rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP
+ rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP, Errno::EPERM
# In the case the user does not have access to
# create the lock file or is using NFS where
# locks are not available we skip locking.
diff --git a/spec/bundler/install/process_lock_spec.rb b/spec/bundler/install/process_lock_spec.rb
index dac0d34bc4..e2b8d20607 100644
--- a/spec/bundler/install/process_lock_spec.rb
+++ b/spec/bundler/install/process_lock_spec.rb
@@ -31,5 +31,16 @@ RSpec.describe "process lock spec" do
expect(processed).to eq true
end
end
+
+ context "when creating a lock raises Errno::EPERM" do
+ before { allow(File).to receive(:open).and_raise(Errno::EPERM) }
+
+ 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