Change inotify watch options to not fire event when file is juste read
This commit is contained in:
parent
3cdcea3dfd
commit
e19a9304ec
@ -10,7 +10,7 @@ module Guard
|
|||||||
|
|
||||||
def on_change(&callback)
|
def on_change(&callback)
|
||||||
@callback = 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
|
unless event.name == "" # Event on root directory
|
||||||
@files << event.absolute_name
|
@files << event.absolute_name
|
||||||
end
|
end
|
||||||
|
@ -38,7 +38,7 @@ describe Guard::Linux do
|
|||||||
file = @fixture_path.join("folder1/file1.txt")
|
file = @fixture_path.join("folder1/file1.txt")
|
||||||
File.exists?(file).should be_true
|
File.exists?(file).should be_true
|
||||||
start
|
start
|
||||||
FileUtils.touch file
|
File.open(file, 'w') {|f| f.write('') }
|
||||||
stop
|
stop
|
||||||
@results.should == ['spec/fixtures/folder1/file1.txt']
|
@results.should == ['spec/fixtures/folder1/file1.txt']
|
||||||
end
|
end
|
||||||
@ -49,8 +49,8 @@ describe Guard::Linux do
|
|||||||
File.exists?(file1).should be_true
|
File.exists?(file1).should be_true
|
||||||
File.exists?(file2).should be_true
|
File.exists?(file2).should be_true
|
||||||
start
|
start
|
||||||
FileUtils.touch file1
|
File.open(file1, 'w') {|f| f.write('') }
|
||||||
FileUtils.touch file2
|
File.open(file2, 'w') {|f| f.write('') }
|
||||||
stop
|
stop
|
||||||
@results.should == ['spec/fixtures/folder1/file1.txt', 'spec/fixtures/folder1/folder2/file2.txt']
|
@results.should == ['spec/fixtures/folder1/file1.txt', 'spec/fixtures/folder1/folder2/file2.txt']
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user