Method not available on this version
This method is only available on newer versions.
The first available version (v2_6_3) is shown here.
filesystem_access(path, action = :write, &block)
public
Rescues permissions errors raised by file system operations (ie.
Errno:EACCESS, Errno::EAGAIN) and raises more friendly errors instead.
@param path [String] the path that the action
will be attempted to @param action [Symbol,
#to_s] the type of operation that will be
performed. For example: :write, :read, :exec
@yield path
@raise [Bundler::PermissionError] if
Errno:EACCES is raised in the
given block
@raise [Bundler::TemporaryResourceError]
if Errno:EAGAIN is raised in the
given block
@example
filesystem_access("vendor/cache", :write) do
FileUtils.mkdir_p("vendor/cache")
end
@see {Bundler::PermissionError}
# File lib/bundler/shared_helpers.rb, line 115
def filesystem_access(path, action = :write, &block)
# Use block.call instead of yield because of a bug in Ruby 2.2.2
# See https://github.com/bundler/bundler/issues/5341 for details
block.call(path.dup.untaint)
rescue Errno::EACCES
raise PermissionError.new(path, action)
rescue Errno::EAGAIN
raise TemporaryResourceError.new(path, action)
rescue Errno::EPROTO
raise VirtualProtocolError.new
rescue Errno::ENOSPC
raise NoSpaceOnDeviceError.new(path, action)
rescue *[const_get_safely(:ENOTSUP, Errno)].compact
raise OperationNotSupportedError.new(path, action)
rescue Errno::EEXIST, Errno::ENOENT
raise
rescue SystemCallError => e
raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
end