ObserverPathnameExtension: only puts first 100 operations
Fixes https://github.com/Homebrew/homebrew/issues/44320#issuecomment-143951973 Closes Homebrew/homebrew#44440. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
ee332c4550
commit
235c5b6bfa
@ -473,6 +473,7 @@ module ObserverPathnameExtension
|
||||
|
||||
def reset_counts!
|
||||
@n = @d = 0
|
||||
@put_verbose_trimmed_warning = false
|
||||
end
|
||||
|
||||
def total
|
||||
@ -482,33 +483,50 @@ module ObserverPathnameExtension
|
||||
def counts
|
||||
[n, d]
|
||||
end
|
||||
|
||||
MAXIMUM_VERBOSE_OUTPUT = 100
|
||||
|
||||
def verbose?
|
||||
return ARGV.verbose? unless ENV["TRAVIS"]
|
||||
return false unless ARGV.verbose?
|
||||
|
||||
if total < MAXIMUM_VERBOSE_OUTPUT
|
||||
true
|
||||
else
|
||||
unless @put_verbose_trimmed_warning
|
||||
puts "Only the first #{MAXIMUM_VERBOSE_OUTPUT} operations were output."
|
||||
@put_verbose_trimmed_warning = true
|
||||
end
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def unlink
|
||||
super
|
||||
puts "rm #{self}" if ARGV.verbose?
|
||||
puts "rm #{self}" if ObserverPathnameExtension.verbose?
|
||||
ObserverPathnameExtension.n += 1
|
||||
end
|
||||
|
||||
def rmdir
|
||||
super
|
||||
puts "rmdir #{self}" if ARGV.verbose?
|
||||
puts "rmdir #{self}" if ObserverPathnameExtension.verbose?
|
||||
ObserverPathnameExtension.d += 1
|
||||
end
|
||||
|
||||
def make_relative_symlink(src)
|
||||
super
|
||||
puts "ln -s #{src.relative_path_from(dirname)} #{basename}" if ARGV.verbose?
|
||||
puts "ln -s #{src.relative_path_from(dirname)} #{basename}" if ObserverPathnameExtension.verbose?
|
||||
ObserverPathnameExtension.n += 1
|
||||
end
|
||||
|
||||
def install_info
|
||||
super
|
||||
puts "info #{self}" if ARGV.verbose?
|
||||
puts "info #{self}" if ObserverPathnameExtension.verbose?
|
||||
end
|
||||
|
||||
def uninstall_info
|
||||
super
|
||||
puts "uninfo #{self}" if ARGV.verbose?
|
||||
puts "uninfo #{self}" if ObserverPathnameExtension.verbose?
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user