merge revision(s) 70f69f8539: [Backport #18941]

[ruby/fileutils] Fix mkdir_p hanging on Windows when trying to create
	 a file on a offline drive

	9cc6a082d7
	---
	 lib/fileutils.rb                 | 2 +-
	 test/fileutils/test_fileutils.rb | 8 ++++++++
	 2 files changed, 9 insertions(+), 1 deletion(-)
This commit is contained in:
nagachika 2022-09-25 15:18:36 +09:00
parent 89eab8e0bf
commit a07e7ad6b0
3 changed files with 10 additions and 2 deletions

View file

@ -1098,6 +1098,14 @@ class TestFileUtils < Test::Unit::TestCase
ensure
Dir.rmdir(drive) if drive and File.directory?(drive)
end
def test_mkdir_p_offline_drive
offline_drive = ("A".."Z").to_a.reverse.find {|d| !File.exist?("#{d}:/") }
assert_raise(Errno::ENOENT) {
mkdir_p "#{offline_drive}:/new_dir"
}
end
end
def test_mkdir_p_file_perm