cleanup: only clean cache if it exists.
Closes Homebrew/homebrew#33297.
This commit is contained in:
		
							parent
							
								
									f7bb519041
								
							
						
					
					
						commit
						b6c2c8cdc8
					
				@ -75,6 +75,7 @@ module Homebrew
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def cleanup_cache
 | 
			
		||||
    return unless HOMEBREW_CACHE.directory?
 | 
			
		||||
    HOMEBREW_CACHE.children.select(&:file?).each do |file|
 | 
			
		||||
      next unless (version = file.version)
 | 
			
		||||
      next unless (name = file.basename.to_s[/(.*)-(?:#{Regexp.escape(version)})/, 1])
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user