change FileUtils.rm_rf -> Util.rm_rf

since the one in FileUtils is broken, or at least does not
work like the command "rm -rf". A post condition should be that
the directory does not exist OR an exception is thrown at failure.
This commit is contained in:
Johan Holmberg
2016-06-03 21:03:12 +02:00
parent 43072aecec
commit 75ea993a54
3 changed files with 11 additions and 3 deletions

@ -178,7 +178,7 @@ module Cmdtest
#------------------------------
def remove_file_tree(filename)
FileUtils.rm_rf(_cwd_path(filename))
Util.rm_rf(_cwd_path(filename))
end
#------------------------------

@ -19,6 +19,8 @@
# along with "cmdtest". If not, see <http://www.gnu.org/licenses/>.
#----------------------------------------------------------------------
require "fileutils"
module Cmdtest
class Util
@ -62,5 +64,11 @@ module Cmdtest
RUBY_PLATFORM =~ /mswin32|mingw32/
end
def self.rm_rf(path)
if File.exist?(path)
FileUtils.rm_r(path) # exception if failing
end
end
end
end

@ -35,8 +35,8 @@ module Cmdtest
@runner = runner
@path = @runner.tmp_work_dir
@hardlinkdir = File.join(@runner.tmp_dir, "hardlinks")
FileUtils.rm_rf(@path)
FileUtils.rm_rf(@hardlinkdir)
Util.rm_rf(@path)
Util.rm_rf(@hardlinkdir)
FileUtils.mkdir_p(@path)
@ignored_files = []
end