mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	[ruby/fileutils] Fix mkdir_p hanging on Windows when trying to create a file on a offline drive
9cc6a082d7This commit is contained in:
		
							parent
							
								
									9f3140a42e
								
							
						
					
					
						commit
						70f69f8539
					
				
					 2 changed files with 9 additions and 1 deletions
				
			
		|  | @ -374,7 +374,7 @@ module FileUtils | |||
|       path = remove_trailing_slash(item) | ||||
| 
 | ||||
|       stack = [] | ||||
|       until File.directory?(path) | ||||
|       until File.directory?(path) || File.dirname(path) == path | ||||
|         stack.push path | ||||
|         path = File.dirname(path) | ||||
|       end | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 David Rodríguez
						David Rodríguez