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:
@ -178,7 +178,7 @@ module Cmdtest
|
|||||||
#------------------------------
|
#------------------------------
|
||||||
|
|
||||||
def remove_file_tree(filename)
|
def remove_file_tree(filename)
|
||||||
FileUtils.rm_rf(_cwd_path(filename))
|
Util.rm_rf(_cwd_path(filename))
|
||||||
end
|
end
|
||||||
|
|
||||||
#------------------------------
|
#------------------------------
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
# along with "cmdtest". If not, see <http://www.gnu.org/licenses/>.
|
# along with "cmdtest". If not, see <http://www.gnu.org/licenses/>.
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
require "fileutils"
|
||||||
|
|
||||||
module Cmdtest
|
module Cmdtest
|
||||||
class Util
|
class Util
|
||||||
|
|
||||||
@ -62,5 +64,11 @@ module Cmdtest
|
|||||||
RUBY_PLATFORM =~ /mswin32|mingw32/
|
RUBY_PLATFORM =~ /mswin32|mingw32/
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.rm_rf(path)
|
||||||
|
if File.exist?(path)
|
||||||
|
FileUtils.rm_r(path) # exception if failing
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -35,8 +35,8 @@ module Cmdtest
|
|||||||
@runner = runner
|
@runner = runner
|
||||||
@path = @runner.tmp_work_dir
|
@path = @runner.tmp_work_dir
|
||||||
@hardlinkdir = File.join(@runner.tmp_dir, "hardlinks")
|
@hardlinkdir = File.join(@runner.tmp_dir, "hardlinks")
|
||||||
FileUtils.rm_rf(@path)
|
Util.rm_rf(@path)
|
||||||
FileUtils.rm_rf(@hardlinkdir)
|
Util.rm_rf(@hardlinkdir)
|
||||||
FileUtils.mkdir_p(@path)
|
FileUtils.mkdir_p(@path)
|
||||||
@ignored_files = []
|
@ignored_files = []
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user