Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4408 - bundler:seg-enotsup, r=segiddins
Browse files Browse the repository at this point in the history
[SharedHelpers] Handle Errno::ENOTSUP in .filesystem_access

Closes #4394.

\c @RochesterinNYC
  • Loading branch information
homu committed Mar 28, 2016
2 parents d716a0a + 6ca09f5 commit b853eab
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/bundler/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,12 @@ def message

status_code(27)
end

class OperationNotSupportedError < PermissionError
def message
"Attempting to #{action} `#{@path}` is unsupported by your OS."
end

status_code(28)
end
end
2 changes: 2 additions & 0 deletions lib/bundler/shared_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def filesystem_access(path, action = :write)
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)
Expand Down
9 changes: 9 additions & 0 deletions spec/bundler/shared_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,15 @@
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
Expand Down

0 comments on commit b853eab

Please sign in to comment.