From a94d4045103ecbeb890822477a07ca84512340d8 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 13 Dec 2015 18:59:34 +0100 Subject: lazy load listen in core See the rationale in the comment present in this patch. --- activesupport/lib/active_support/evented_file_update_checker.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/evented_file_update_checker.rb b/activesupport/lib/active_support/evented_file_update_checker.rb index c1c30b1a86..315be85fb3 100644 --- a/activesupport/lib/active_support/evented_file_update_checker.rb +++ b/activesupport/lib/active_support/evented_file_update_checker.rb @@ -1,4 +1,3 @@ -require 'listen' require 'set' require 'pathname' require 'concurrent/atomic/atomic_boolean' @@ -19,6 +18,10 @@ module ActiveSupport @lcsp = @ph.longest_common_subpath(@dirs.keys) if (dtw = directories_to_watch).any? + # Loading listen triggers warnings. These are originated by a legit + # usage of attr_* macros for private attributes, but adds a lot of noise + # to our test suite. Thus, we lazy load it and disable warnings locally. + silence_warnings { require 'listen' } Listen.to(*dtw, &method(:changed)).start end end -- cgit v1.2.3