summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <hello@colby.fyi>2018-06-09 00:47:59 +1000
committerColby Swandale <hello@colby.fyi>2018-06-15 11:15:15 +1000
commit5fa3b679f548f17bd9607bb7bc2e0d0e133f5887 (patch)
tree26a8dc0bc95a7e2d15e6ddd3f71467c4f3c9b0a5
parent63f0561d8391271c4a9b0551037c4a16686c5c4e (diff)
downloadbundler-colby/process-lock-enotsup.tar.gz
handle Errno::ENOTSUP in Bundler process lock filecolby/process-lock-enotsup
-rw-r--r--lib/bundler/process_lock.rb2
-rw-r--r--spec/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 4bd6931577..cba4fcdba5 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
+ rescue Errno::EACCES, Errno::ENOLCK, *[SharedHelpers.const_get_safely(:ENOTSUP, Errno)].compact
# 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/install/process_lock_spec.rb b/spec/install/process_lock_spec.rb
index 02217f493b..be8fd04fdd 100644
--- a/spec/install/process_lock_spec.rb
+++ b/spec/install/process_lock_spec.rb
@@ -20,5 +20,16 @@ RSpec.describe "process lock spec" do
thread.join
expect(the_bundle).to include_gems "rack 1.0"
end
+
+ context "when creating a lock raises Errno::ENOTSUP", :ruby => ">= 1.9" do
+ before { allow(File).to receive(:open).and_raise(Errno::ENOTSUP) }
+
+ 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