From 8a63b9424716af3d28960f68d2c7c58cfe7a0cbf Mon Sep 17 00:00:00 2001 From: Yann Lugrin Date: Thu, 21 Oct 2010 16:04:57 +0800 Subject: [PATCH] waiting on file system event don't block process on linux now (guard can be stopped, spec run but don't pass) --- lib/guard/listeners/linux.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/guard/listeners/linux.rb b/lib/guard/listeners/linux.rb index f19a8db..2876514 100644 --- a/lib/guard/listeners/linux.rb +++ b/lib/guard/listeners/linux.rb @@ -45,13 +45,16 @@ module Guard def watch_change while !@stop - inotify.process - unless files.empty? - files.map! { |file| file.gsub("#{Dir.pwd}/", '') } - callback.call(files) - files.clear + if IO.select([notifier.to_io], [], [], latency) + notifier.process + + unless files.empty? + files.map! { |file| file.gsub("#{Dir.pwd}/", '') } + callback.call(files) + files.clear + end + sleep latency end - sleep latency end end