Skip to content

Instantly share code, notes, and snippets.

@AW-Britt
Created June 5, 2025 05:48
Show Gist options
  • Select an option

  • Save AW-Britt/4d412ec308f5890c9bd68756f13bfef4 to your computer and use it in GitHub Desktop.

Select an option

Save AW-Britt/4d412ec308f5890c9bd68756f13bfef4 to your computer and use it in GitHub Desktop.
Workaround vagrant-vbguest plugin fail due to NoSuchMethod error on `File.exists?`
# Place this blurb at the top of your Vagrantfile to allow the unpatched
# version of the Vagrant vagrant-vbguest plugin to properly execute
# in newer Ruby environments where File.exists is no longer supported
#
# Extend the Ruby File class to restore the deprecated exists method
# calls File.exist instead
unless File.respond_to?(:exists?)
class << File
def exists?(path)
warn "File.exists? is deprecated; use File.exist? instead." unless ENV['SUPPRESS_FILE_EXISTS_WARNING']
exist?(path)
end
end
end
@ParsaJR
Copy link

ParsaJR commented Jun 6, 2025

thanks. it works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment