aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/cleanup.rb
diff options
context:
space:
mode:
authorAdam Vandenberg2014-05-17 16:59:14 -0700
committerAdam Vandenberg2014-05-17 16:59:14 -0700
commit4af6de27d0f44f4e5eaa998400493bf6fd9fdc3f (patch)
treec05093ce46bc5677d3cf7861f94c6af7e6fe3b25 /Library/Homebrew/cmd/cleanup.rb
parentc6eba941fc6ee4dfbbbd1e94c1e1c875fac3ea06 (diff)
downloadhomebrew-4af6de27d0f44f4e5eaa998400493bf6fd9fdc3f.tar.bz2
only clean logs if logs exist
Closes #29355.
Diffstat (limited to 'Library/Homebrew/cmd/cleanup.rb')
-rw-r--r--Library/Homebrew/cmd/cleanup.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb
index 456d28d29..aedec2303 100644
--- a/Library/Homebrew/cmd/cleanup.rb
+++ b/Library/Homebrew/cmd/cleanup.rb
@@ -5,6 +5,8 @@ require 'bottles'
module Homebrew extend self
def cleanup
+ # individual cleanup_ methods should also check for the existence of the
+ # appropriate directories before assuming they exist
return unless HOMEBREW_CELLAR.directory?
if ARGV.named.empty?
@@ -21,6 +23,7 @@ module Homebrew extend self
end
def cleanup_logs
+ return unless HOMEBREW_LOGS.directory?
time = Time.now - 2 * 7 * 24 * 60 * 60 # two weeks
HOMEBREW_LOGS.subdirs.each do |dir|
if dir.mtime < time