Change inotify watch options to not fire event when file is juste read

This commit is contained in:
Yann Lugrin 2010-10-23 19:33:13 +08:00 committed by Thibaud Guillaume-Gentil
parent 3cdcea3dfd
commit e19a9304ec
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ module Guard
def on_change(&callback)
@callback = callback
inotify.watch(Dir.pwd, :recursive, :attrib, :modify, :create) do |event|
inotify.watch(Dir.pwd, :recursive, :modify, :create, :delete, :move) do |event|
unless event.name == "" # Event on root directory
@files << event.absolute_name
end

View File

@ -38,7 +38,7 @@ describe Guard::Linux do
file = @fixture_path.join("folder1/file1.txt")
File.exists?(file).should be_true
start
FileUtils.touch file
File.open(file, 'w') {|f| f.write('') }
stop
@results.should == ['spec/fixtures/folder1/file1.txt']
end
@ -49,8 +49,8 @@ describe Guard::Linux do
File.exists?(file1).should be_true
File.exists?(file2).should be_true
start
FileUtils.touch file1
FileUtils.touch file2
File.open(file1, 'w') {|f| f.write('') }
File.open(file2, 'w') {|f| f.write('') }
stop
@results.should == ['spec/fixtures/folder1/file1.txt', 'spec/fixtures/folder1/folder2/file2.txt']
end