From 23e50c98f91fbea538e1188c2039f70a60e2bab6 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 20 Jun 2016 07:13:55 -0400 Subject: [PATCH] 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 --- lib/vagrant/box_collection.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/box_collection.rb b/lib/vagrant/box_collection.rb index 24e1c7124..5a295df29 100644 --- a/lib/vagrant/box_collection.rb +++ b/lib/vagrant/box_collection.rb @@ -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.