core/box_collection: Ensure removal

The docs for Ruby say Pathname#rmtree will recursively delete, but
apparently that is a lie, at least on Windows (see GH-7496). Switch to
using FileUtils to ensure the directory is deleted.

Fixes GH-7496
This commit is contained in:
Seth Vargo 2016-06-20 07:13:55 -04:00
parent 5650896732
commit 23e50c98f9
No known key found for this signature in database
GPG Key ID: 905A90C2949E8787
1 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,5 @@
require "digest/sha1"
require "fileutils"
require "monitor"
require "tmpdir"
@ -447,7 +448,7 @@ module Vagrant
yield dir
ensure
dir.rmtree if dir.exist?
FileUtils.rm_rf(dir.to_s)
end
# Checks if a box with a given name exists.