Sha256: 8e8721bb157d00c54e91b007a5ead7404e742d2a055ced4cdff0438c7b271ed9

Contents?: true

Size: 737 Bytes

Versions: 7

Compression:

Stored size: 737 Bytes

Contents

module VagrantPlugins
  module GuestLinux
    module Cap
      class SSHFSGetAbsolutePath
        def self.sshfs_get_absolute_path(machine, path)
          abs_path = ""
          machine.communicate.execute("readlink -f #{path}", sudo: true) do |type, data|
            if type == :stdout
              abs_path = data
            end
          end

          if ! abs_path
            # If no real absolute path was detected then error out
            error_class = VagrantPlugins::SyncedFolderSSHFS::Errors::SSHFSGetAbsolutePathFailed
            raise error_class, path: path
          end

          # Chomp the string so that any trailing newlines are killed
          return abs_path.chomp
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vagrant-sshfs-1.3.7 lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
vagrant-sshfs-1.3.6 lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
vagrant-sshfs-1.3.5 lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
vagrant-sshfs-1.3.4 lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
vagrant-sshfs-1.3.3 lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
vagrant-sshfs-1.3.2 lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
vagrant-sshfs-1.3.1 lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb