Sha256: 97731877188fa76c4c54f9d42f0a77561f6ebc16f52c7c96553debb2b4333036

Contents?: true

Size: 805 Bytes

Versions: 20

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true
require_relative '../../puppet/file_system/posix'

class Puppet::FileSystem::JRuby < Puppet::FileSystem::Posix
  def unlink(*paths)
    File.unlink(*paths)
  rescue Errno::ENOENT
    # JRuby raises ENOENT if the path doesn't exist or the parent directory
    # doesn't allow execute/traverse. If it's the former, `stat` will raise
    # ENOENT, if it's the later, it'll raise EACCES
    # See https://github.com/jruby/jruby/issues/5617
    stat(*paths)
  end

  def replace_file(path, mode = nil, &block)
    # MRI Ruby rename checks if destination is a directory and raises, while
    # JRuby removes the directory and replaces the file.
    if directory?(path)
      raise Errno::EISDIR, _("Is a directory: %{directory}") % { directory: path }
    end

    super
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-8.3.0 lib/puppet/file_system/jruby.rb
puppet-8.3.0-x86-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.3.0-x64-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.3.0-universal-darwin lib/puppet/file_system/jruby.rb
puppet-8.3.1 lib/puppet/file_system/jruby.rb
puppet-8.3.1-x86-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.3.1-x64-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.3.1-universal-darwin lib/puppet/file_system/jruby.rb
puppet-8.2.0 lib/puppet/file_system/jruby.rb
puppet-8.2.0-x86-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.2.0-x64-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.2.0-universal-darwin lib/puppet/file_system/jruby.rb
puppet-8.1.0 lib/puppet/file_system/jruby.rb
puppet-8.1.0-x86-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.1.0-x64-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.1.0-universal-darwin lib/puppet/file_system/jruby.rb
puppet-8.0.1 lib/puppet/file_system/jruby.rb
puppet-8.0.1-x86-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.0.1-x64-mingw32 lib/puppet/file_system/jruby.rb
puppet-8.0.1-universal-darwin lib/puppet/file_system/jruby.rb