summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-03-30 08:04:13 +0900
committerHomu <homu@barosl.com>2016-03-30 08:04:13 +0900
commit015c1cb52b47c9f7f644652ffdaa7fefcfd0f815 (patch)
tree4ccf4e3e21975348dc9edcca63ee9cdf3a3d7696
parent755e1a49f29ecc87dbf619310326cc1057adf697 (diff)
parente2e8aa7d78b76cfb49404fa4226572df76fe0946 (diff)
downloadbundler-015c1cb52b47c9f7f644652ffdaa7fefcfd0f815.tar.gz
Auto merge of #4408 - bundler:seg-enotsup, r=indirect
[SharedHelpers] Handle Errno::ENOTSUP in .filesystem_access Closes #4394. \c @RochesterinNYC
-rw-r--r--lib/bundler/errors.rb8
-rw-r--r--lib/bundler/shared_helpers.rb2
-rw-r--r--spec/bundler/shared_helpers_spec.rb9
3 files changed, 19 insertions, 0 deletions
diff --git a/lib/bundler/errors.rb b/lib/bundler/errors.rb
index 7b893e664f..f6c9150121 100644
--- a/lib/bundler/errors.rb
+++ b/lib/bundler/errors.rb
@@ -107,4 +107,12 @@ module Bundler
status_code(27)
end
+
+ class OperationNotSupportedError < PermissionError
+ def message
+ "Attempting to #{action} `#{@path}` is unsupported by your OS."
+ end
+
+ status_code(28)
+ end
end
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index c79c88c5e1..e21d616ecd 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -109,6 +109,8 @@ module Bundler
raise TemporaryResourceError.new(path, action)
rescue Errno::EPROTO
raise VirtualProtocolError.new
+ rescue *[const_get_safely(:ENOTSUP, Errno)].compact
+ raise OperationNotSupportedError.new(path, action)
end
def const_get_safely(constant_name, namespace)
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb
index 348889a326..98f7994f9f 100644
--- a/spec/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/shared_helpers_spec.rb
@@ -369,6 +369,15 @@ describe Bundler::SharedHelpers do
Bundler::VirtualProtocolError)
end
end
+
+ context "system throws Errno::ENOTSUP", :ruby => "1.9" do
+ let(:file_op_block) { proc {|_path| raise Errno::ENOTSUP } }
+
+ it "raises a OperationNotSupportedError" do
+ expect { subject.filesystem_access("/path", &file_op_block) }.to raise_error(
+ Bundler::OperationNotSupportedError)
+ end
+ end
end
describe "#const_get_safely" do