diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-03-28 14:54:57 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-03-28 14:54:57 -0500 |
commit | 6ca09f574220a6bded14069f7163980551f54341 (patch) | |
tree | 10152a0cb77ab8ff09885f6a3d649b7e941c95f9 | |
parent | 4a4fec7f69752e7da70f0a622b47cd28c318386f (diff) | |
download | bundler-6ca09f574220a6bded14069f7163980551f54341.tar.gz |
[SharedHelpers] Handle Errno::ENOTSUP in .filesystem_access
-rw-r--r-- | lib/bundler/errors.rb | 8 | ||||
-rw-r--r-- | lib/bundler/shared_helpers.rb | 2 | ||||
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 9 |
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..310eca35b0 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 Errno::ENOTSUP + 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..b22171a8c4 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" 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 |