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:
lib/cmdtest
@ -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
|
||||
|
Reference in New Issue
Block a user