Rescue TypeError when checking for NFS and return false [closes GH-109]

This commit is contained in:
Mitchell Hashimoto 2010-07-13 20:30:24 -07:00
parent 1bfb99d606
commit 7e9b75f939
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,8 @@ module Vagrant
def nfs? def nfs?
system("which nfsd") system("which nfsd")
$?.to_i == 0 $?.to_i == 0
rescue TypeError
false
end end
def nfs_export(ip, folders) def nfs_export(ip, folders)

View File

@ -26,6 +26,11 @@ class BSDHostTest < Test::Unit::TestCase
assert !@instance.nfs? assert !@instance.nfs?
end end
should "not support NFS if an error is raised" do
@instance.expects(:system).raises(TypeError.new("foo"))
assert !@instance.nfs?
end
end end
context "nfs export" do context "nfs export" do